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

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2019 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].