Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Parameter issue
has no ratings.
Published: 19 Mar 2015
Revised: 20 Mar 2015 - 3319 days ago
Last viewed on: 19 Apr 2024 (3680 views) 

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.

Parameter issue Published by: Chris Proctor on 19 Mar 2015 view comments(5)

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

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Parameter issue
Posted: 9 years 1 months 1 days 19 hours 5 minutes ago

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.

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Parameter issue
Posted: 9 years 1 months 1 days 18 hours 51 minutes ago

A couple of good  solutions. Thanks, Bob.

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Parameter issue
Posted: 9 years 1 months 1 days 17 hours 59 minutes ago

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?

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Parameter issue
Posted: 9 years 1 months 1 days 15 hours 53 minutes ago
Edited: Thu, 19 Mar, 2015 at 16:49:42 (3320 days ago)

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
Posted by: Ringer
Premium member *
Comment on: Parameter issue
Posted: 9 years 1 months 23 hours 49 minutes ago

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