Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Good morning. I thought I've seen a post on this, but can't find it. I have a program where I am passing 11 parms to it. Ten of the parms are 75A in length. From a command line, if I call the program without all 75 characters I'm seeing more than one of the parms in a single parm field. Is there any way around this? I'm thinking that all 75 chars have to been entered (blank fill) for each parm. Here's a snippet of code and a parm field in debug:
ddropSprocs pr extpgm('DROPSPROC')
d plib 10a
d psproc1 75a
d psproc2 75a options(*nopass)
d psproc3 75a options(*nopass)
....5...10...15...20...25...30...35...40...45...50...55...60
1 'spasnitmi spasnordi '
61 ' '
Thanks!
Chris
Command line parms are passed as 32 bytes if they are less than 32 bytes.
That is what you're seeing.
The only work around is to either call it with 75-char parms (CL Variables) within a CL program, or better yet, define a command defintion with all the parms declared and have it call your program. That way the issue doesn't occur.
A couple of good solutions. Thanks, Bob.
I've created a command with one parameter and a min(1) and max(10), since all 10 parms are 75A in length, but now how do I define the parms in the program? Just one large field (75x10) then parse out the 10 values?
The MAX(x) feature passes in the values as an array prefixed with a count. The count is 5i0 in length (short int).
If you do NOT want to use 10 different parameters, then you define them as a DS with two subfields:
D myValues_T DS Qualified D count 5I 0 D parmVal 75A Dim(10) D entryPlist PI D userValues LikeDS(myValues_T) Const /free for i = 1 to userValues.count; if (userValues.parmVal(i) <> ' '); // Not blank... // do something. endif; endfor; /end-free
It's a HACK but you can pass the 75A parms from command line as 76A with an 'x' in position 76. OS/400 will define the parms as 76A on-the-fly and RPG can still define and use the parms as 75A, it doesn't care.
Chris Ringer