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



Thanks, Paul, that's what I needed.

-Kurt

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Morgan, Paul
Sent: Thursday, June 30, 2011 2:38 PM
To: Midrange Systems Technical Discussion
Subject: RE: CL calling RPG with Varying Parm

Kurt,

You could define the variable as a 9 ((length + 1)/2 rounded up) byte character string. Use a hexadecimal constant to assign the number to the character string. You must include leading zeros and a trailing sign nibble (F for positive, D for negative):

DCL VAR(&LONGNUM) TYPE(*CHAR) LEN(9) VALUE(X'00000001234567890F')

for the number 1,234,567,890 in packed 16.0 format.

I'm on V5R4 so I can't confirm for 7.1 but the digits limit still appears to be 15 digits however the decimal limit has always been 9 and not 5:

DCL VAR(&NUMLIMIT) TYPE(*DEC) LEN(15 9)

15.5 packed is the numeric format for a raw numeric passed as a parameter on a CALL command.

Thanks,
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 2:53 PM
To: Midrange Systems Technical Discussion
Subject: RE: CL calling RPG with Varying Parm

Do you have any tips for me trying to pass a 16 (16,0) digit numeric value from CL to RPG? Ie. Any way to get around the 15,5 limitation?

Thanks,
Kurt

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Morgan, Paul
Sent: Thursday, June 30, 2011 11:21 AM
To: Midrange Systems Technical Discussion
Subject: RE: CL calling RPG with Varying Parm

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
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.



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.