× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Kurt,

The varying length is a two byte integer value at the start of &PARM1.

To match the variable in the RPG program

DCL VAR(&PARM1) TYPE(*CHAR) LEN(52)

CHGVAR VAR(%SST(&PARM1 1 2)) VALUE(X'0032')
CHGVAR VAR(%SST(&PARM1 3 50)) VALUE('508656904670')

CALL PGM(RPGPRogram) PARM(&PARM1)

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt Anderson
Sent: Thursday, June 30, 2011 11:56 AM
To: 'Midrange Systems Technical Discussion' (midrange-l@xxxxxxxxxxxx)
Subject: CL calling RPG with Varying Parm

I'm trying to unit test a program that has a varying parameter and I can't seem to get the call to work successfully. I keep getting a "Length of varying length variable is out of range" error as the RPG program moves the entry parameter into another field.

RPG Prototype:
D RPGProgram PR
D parm1 50a Const Varying

Technically, parm1 is defined like a file's field that has VARLEN specified. I believe RPG treats that as Varying when you do a LIKE.

CL call:
DCL VAR(&PARM1) TYPE(*CHAR) LEN(53)

/* first two bytes of value is the length */
CHGVAR VAR(&PARM1) VALUE('508656904670')

/* to prevent truncating trailing of blanks */
CHGVAR VAR(%SST(&PARM1 53 1)) VALUE('X')

CALL PGM(RPGProgram) PARM(&PARM1)

I've tried this a variety of ways. With LEN(50), w/o the trailing X, w/o specifying the length in &PARM1.

I'm on 7.1.

Thanks for the help,

Kurt Anderson
Sr. Programmer/Analyst
CustomCall Data Systems

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.