× 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.



On 30-Jun-2011 08:55 , Kurt Anderson wrote:
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.


From a command line, there is the option to use:

call RPGprogram parm(x'000CF5F0F8F6F5F6F9F0F4F6F7F0')

Or for a CLP, something like [the untested; syntax or otherwise]:

dcl &varchar *char len(52) stg(*auto)
dcl &vclen *int len( 2) stg(*defined) defvar(&varchar 1)
dcl &vcdta *char len(50) stg(*defined) defvar(&varchar 3)

chgvar &vcdta VALUE('508656904670')
chgvar &vclen VALUE(12) /* or set actual length from data */
call RPGprogram PARM(&varchar)

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.