Pete,
You are trying to call an RPGLE program with a varying length variable. This is not impossible from the command line but it is challenging. Your first two bytes in the string have to be the integer value for following string's length. So, you have to pass in the hex representation of string length + the string.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Pete Helgren
Sent: Wednesday, February 11, 2015 2:20 PM
To: RPG Midrange Discussion
Subject: Parameter lengths and calling from command line
I have spent too much time in the Java/JavaScript world apparently because I have been attempting to write what I thought was a simple RPGLE program which I can call from a command line. The problem is that the parameter, which is a character type, 256 in length, gets padded with "unexpected" contents beyond what I am submitting on the command line. If I submit it like so:
CALL PGM(MYPGM) PARM(This is a test') I see something like this when I
view the contents in either debug or the receiving program:
This is a testRPGLESRC MYLIBRAY MYPGM ??*SRCMBRTXT ‑ 1? *HEX *JOBRUN1 0 *NEW 0*LIBCRTAUT1 *CURRENT0*NONE
I understand, from reading numerous posts, that this is normal behavior but my attempts to follow the directions to eliminate the issue seems for naught. I couldn't find an example program in all of MY libraries that does something similar without the side effects (I could have sworn I have written RPG programs like this before).
The program has these Prototypes/Procedure interfaces:
D mypgm pr extpgm('MYPGM')
D text 256A varying const options(*trim)
D mypgm pi
D text 256A varying const options(*trim)
I originally defined 'text' as 256A but saw the spurious characters.
So I tried options(*varsize), same result. So I tried varying const
options(*trim). No joy ( get a variable out of range error). It is a little early in the week to be going brain dead but apparently I have.
I can't seem to sort this out.
I want to pass a character string of up to 256 characters into this program and only get the characters typed as the parameter value. What am I missing?
--
Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.