CL passing Parm to RPG - IBM AS400

This is a discussion on CL passing Parm to RPG - IBM AS400 ; Guys - This is a little difficult for me to work on..since I never passed Parameters between program before... (I'll get all the ribbing from you guys/gals). I created a CL program that has 4 variables (field1, field2, field3, field4). ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: CL passing Parm to RPG

  1. CL passing Parm to RPG

    Guys -

    This is a little difficult for me to work on..since I never passed
    Parameters between program before... (I'll get all the ribbing from you
    guys/gals).

    I created a CL program that has 4 variables (field1, field2, field3,
    field4). I put in the call command, listing those 4 fields.

    In the RPG program I put in the *ENTRY PLIST and list each of the fields
    with PRAM.

    Both compile works, but when I run the program, it bombs out saying
    "Program Referenced to a perameter not passed"

    here is the sample of the program

    CLP Program:
    IF COND(&IN24 *EQ '1') THEN(GOTO CMDLBL(END))
    CALL PGM(DTALIB/SHOPIFS) PARM('&ITNBR &JOBNO +
    &RQDTE &QTYOR')

    RPG Program
    *ENTRY PLIST
    PARM ITNBR 15
    PARM JOBNO 8
    PARM RQDTE 60
    PARM QTYOR 70

    I do not understand what is wrong. Both CL and RPG manuals are not
    exactly forthcomming...even GOOGLE search is a little daunting.

    I will check back tomorrow morning (Wed) to see what you have to say.

    Again..

    THANK YOU ALL ! ! !

    Making my life a little better...

    Gil

  2. Re: CL passing Parm to RPG

    Gilbert Noetzel wrote:
    > Guys -
    >
    > This is a little difficult for me to work on..since I never passed
    > Parameters between program before... (I'll get all the ribbing from you
    > guys/gals).
    >
    > I created a CL program that has 4 variables (field1, field2, field3,
    > field4). I put in the call command, listing those 4 fields.
    >
    > In the RPG program I put in the *ENTRY PLIST and list each of the fields
    > with PRAM.
    >
    > Both compile works, but when I run the program, it bombs out saying
    > "Program Referenced to a perameter not passed"
    >
    > here is the sample of the program
    >
    > CLP Program:
    > IF COND(&IN24 *EQ '1') THEN(GOTO CMDLBL(END))
    > CALL PGM(DTALIB/SHOPIFS) PARM('&ITNBR &JOBNO +
    > &RQDTE &QTYOR')
    >
    > RPG Program
    > *ENTRY PLIST
    > PARM ITNBR 15
    > PARM JOBNO 8
    > PARM RQDTE 60
    > PARM QTYOR 70
    >
    > I do not understand what is wrong. Both CL and RPG manuals are not
    > exactly forthcomming...even GOOGLE search is a little daunting.
    >


    I know very little about RPG, but the PARM() parameter of your CALL
    statement has quotes wrapping a single string. This means the CALL is
    only passing one parameter whereas your intent (I believe) is to pass
    four. Try removing the quotes.
    V V
    PARM('&ITNBR &JOBNO &RQDTE &QTYOR')

    (This appears to be the same problem as discussed in the thread titled
    "Re: CL program..Am I Blind on my mistakes?")

    --
    Karl Hanson

  3. Re: CL passing Parm to RPG

    Hi Gilbert,

    Don't feel too bad. CL is a pain to format :-)

    This one is very subtle, but you want to make sure not to pass the single
    quotes around all the parm values.

    Fixed version of your call:
    CALL PGM(DTALIB/SHOPIFS) PARM(&ITNBR &JOBNO +
    &RQDTE &QTYOR)

    In effect, your first version was passing a string lteral value of: '&ITNBR
    &JOBNO + &RQDTE &QTYOR' as the first parameter value, that's probably why
    you got the parm mismatch.

    Once you remove the single quotes, then all the parameters will get passed
    correctly.

    Hope this helps.

    Regards,
    Richard Schoen
    RJS Software Systems Inc.
    "Providing Your....iNFORMATION NOW!"
    Email: richard@rjssoftware.com
    Web Site: http://www.rjssoftware.com
    Tel: (952) 898-3038
    Fax: (952) 898-1781
    Toll Free: (888) RJSSOFT


    "Gilbert Noetzel" wrote in message
    newss7yh.43883$Ts.37352@bignews6.bellsouth.net...
    > Guys -
    >
    > This is a little difficult for me to work on..since I never passed
    > Parameters between program before... (I'll get all the ribbing from you
    > guys/gals).
    >
    > I created a CL program that has 4 variables (field1, field2, field3,
    > field4). I put in the call command, listing those 4 fields.
    >
    > In the RPG program I put in the *ENTRY PLIST and list each of the fields
    > with PRAM.
    >
    > Both compile works, but when I run the program, it bombs out saying
    > "Program Referenced to a perameter not passed"
    >
    > here is the sample of the program
    >
    > CLP Program:
    > IF COND(&IN24 *EQ '1') THEN(GOTO CMDLBL(END))
    > CALL PGM(DTALIB/SHOPIFS) PARM('&ITNBR &JOBNO +
    > &RQDTE &QTYOR')
    >
    > RPG Program
    > *ENTRY PLIST
    > PARM ITNBR 15
    > PARM JOBNO 8
    > PARM RQDTE 60
    > PARM QTYOR 70
    >
    > I do not understand what is wrong. Both CL and RPG manuals are not
    > exactly forthcomming...even GOOGLE search is a little daunting.
    >
    > I will check back tomorrow morning (Wed) to see what you have to say.
    >
    > Again..
    >
    > THANK YOU ALL ! ! !
    >
    > Making my life a little better...
    >
    > Gil




  4. Re: CL passing Parm to RPG

    On Feb 6, 2:39 pm, Gilbert Noetzel wrote:
    > Guys -
    >
    > This is a little difficult for me to work on..since I never passed
    > Parameters between program before... (I'll get all the ribbing from you
    > guys/gals).
    >
    > I created a CL program that has 4 variables (field1, field2, field3,
    > field4). I put in the call command, listing those 4 fields.
    >
    > In the RPG program I put in the *ENTRY PLIST and list each of the fields
    > with PRAM.
    >
    > Both compile works, but when I run the program, it bombs out saying
    > "Program Referenced to a perameter not passed"
    >
    > here is the sample of the program
    >
    > CLP Program:
    > IF COND(&IN24 *EQ '1') THEN(GOTO CMDLBL(END))
    > CALL PGM(DTALIB/SHOPIFS) PARM('&ITNBR &JOBNO +
    > &RQDTE &QTYOR')
    >
    > RPG Program
    > *ENTRY PLIST
    > PARM ITNBR 15
    > PARM JOBNO 8
    > PARM RQDTE 60
    > PARM QTYOR 70
    >
    > I do not understand what is wrong. Both CL and RPG manuals are not
    > exactly forthcomming...even GOOGLE search is a little daunting.
    >
    > I will check back tomorrow morning (Wed) to see what you have to say.
    >
    > Again..
    >
    > THANK YOU ALL ! ! !
    >
    > Making my life a little better...
    >
    > Gil


    I agree with Gil, the problem is the quotes on your call command.

    You are probably going to find another "feature" of the AS400 is that
    it may pass what appears to be garbage in that last long character
    parameter. OS400 assumes if the total length of characters being
    passed is greater than 32, that you will code the length of the text
    being passed and only allocates the space occupied in the CL to the
    RPG buffer. Trailing blanks in the last parameter get suppressed and
    the remainder of the buffer passed appears be truncated. There are
    several ways around this, but I've found the simplest and easiest is
    to add a one character parameter on the Call (e.g. &Success
    (initialized to '0')) which I use to return a success/fail condition
    from the called program which I can look for in the CL. By making the
    last parm a single character, it appends after the last long variable
    in the buffer and marks the end of the blank part of that (previously)
    last parameter.

    Good luck
    Greg


  5. Re: CL passing Parm to RPG

    Argo wrote:

    > You are probably going to find another "feature" of the AS400 is that
    > it may pass what appears to be garbage in that last long character
    > parameter. OS400 assumes if the total length of characters being
    > passed is greater than 32, that you will code the length of the text
    > being passed and only allocates the space occupied in the CL to the
    > RPG buffer. Trailing blanks in the last parameter get suppressed and
    > the remainder of the buffer passed appears be truncated. There are
    > several ways around this, but I've found the simplest and easiest is
    > to add a one character parameter on the Call (e.g. &Success
    > (initialized to '0')) which I use to return a success/fail condition
    > from the called program which I can look for in the CL. By making the
    > last parm a single character, it appends after the last long variable
    > in the buffer and marks the end of the blank part of that (previously)
    > last parameter.



    Although late, I wanted to comment on a possible misunderstanding that
    can come out of this. "OS400 assumes" only when no declaration of the
    parms is associated with the CALL. This generally happens in one of two
    cases -- the CALL is executed outside of a program as an interactive
    command-line command, or the CALL is submitted as a batch command
    through SBMJOB and the CMD() parameter is used instead of RQSDTA().

    When the CALL is executed as a compiled command and the parms are
    declared variables, the declared memory addresses are used.

    However, if constants/literals are used as parms, then OS/400 will
    always use a temporary space with a definition of at least 32 bytes to
    hold those parms. When the literal lengths are longer than 32, OS/400
    will use the actual length. The temporary addresses of the literals are
    used to construct the parameter list. (OS/400 has to use _some_ definition.)

    For literal numeric parms, the default definition will be *DEC (15 5).

    --
    Tom Liotta
    http://zap.to/tl400

+ Reply to Thread