RPGII call to RPG ILE pgm - IBM AS400

This is a discussion on RPGII call to RPG ILE pgm - IBM AS400 ; Barbara Morris (or anyone else) I have a huge RPG II program I don't want to rewrite, but unfortunately need to make a change in logic. I would like to call an RPG ILE program from it and pass 3 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: RPGII call to RPG ILE pgm

  1. RPGII call to RPG ILE pgm

    Barbara Morris (or anyone else)

    I have a huge RPG II program I don't want to rewrite, but
    unfortunately need to make a change in logic. I would like to call an
    RPG ILE program from it and pass 3 parameters.

    Two of the parms are alpha and one is numeric (7/0)

    Will this work? Are the call/parms compatible? Something sticks in
    my mind that they might not be between RPG II and RPGIII or RPG ILE?

    For instance:

    Call
    Parm Parm1 8
    Parm Parm2 8
    Parm Parm3 7 0


    *Entry Plist
    Parm Parm4 8
    Parm Parm5 8
    Parm Parm6 7 0

    When the called program returns to the caller (RPG II), will parm 3 be
    the correct length, etc.???

    ga

    ga
    nospam@nospam.fmctc.com

  2. Re: RPGII call to RPG ILE pgm

    On 6 Maj, 17:50, ga wrote:
    > Barbara Morris (or anyone else)
    >
    > I have a huge RPG II program I don't want to rewrite, but
    > unfortunately need to make a change in logic. *I would like to call an
    > RPG ILE program from it and pass 3 parameters. *
    >
    > Two of the parms are alpha and one is numeric (7/0)
    >
    > Will this work? *Are the call/parms compatible? *Something sticks in
    > my mind that they might not be between RPG II and RPGIII or RPG ILE?
    >
    > For instance:
    >
    > * * * * * * * * Call * *
    > * * * * * * * * Parm * * * * * *Parm1 * 8
    > * * * * * * * * Parm * * * * * *Parm2 * 8 * * *
    > * * * * * * * * Parm * * * * * *Parm3 * 7 0
    >
    > * * * * *Entry *Plist
    > * * * * * * * * Parm * * * * * *Parm4 * 8
    > * * * * * * * * Parm * * * * * *Parm5 * 8
    > * * * * * * * * Parm * * * * * *Parm6 * 7 0
    >
    > When the called program returns to the caller (RPG II), will parm 3 be
    > the correct length, etc.???
    >
    > ga
    >
    > ga
    > nos...@nospam.fmctc.com


    No,

    What I'd do (and have done) is to use a character variable for the
    numeric, and simply use the move opcode in both programs. RPGII uses
    signed numerics in parms and ILE and/or RPGIII/IV uses packed
    numerics.

    Regards
    Niels

  3. Re: RPGII call to RPG ILE pgm

    Thanks Niels,

    I did what you said and it worked fine. I didn't even try it the
    other way.

    Thanks A BUNCH for your quick reply!!

    ga

    nsm wrote:

    >On 6 Maj, 17:50, ga wrote:
    >> Barbara Morris (or anyone else)
    >>
    >> I have a huge RPG II program I don't want to rewrite, but
    >> unfortunately need to make a change in logic. *I would like to call an
    >> RPG ILE program from it and pass 3 parameters. *
    >>
    >> Two of the parms are alpha and one is numeric (7/0)
    >>
    >> Will this work? *Are the call/parms compatible? *Something sticks in
    >> my mind that they might not be between RPG II and RPGIII or RPG ILE?
    >>
    >> For instance:
    >>
    >> * * * * * * * * Call * *
    >> * * * * * * * * Parm * * * * * *Parm1 * 8
    >> * * * * * * * * Parm * * * * * *Parm2 * 8 * * *
    >> * * * * * * * * Parm * * * * * *Parm3 * 7 0
    >>
    >> * * * * *Entry *Plist
    >> * * * * * * * * Parm * * * * * *Parm4 * 8
    >> * * * * * * * * Parm * * * * * *Parm5 * 8
    >> * * * * * * * * Parm * * * * * *Parm6 * 7 0
    >>
    >> When the called program returns to the caller (RPG II), will parm 3 be
    >> the correct length, etc.???
    >>
    >> ga
    >>
    >> ga
    >> nos...@nospam.fmctc.com

    >
    >No,
    >
    >What I'd do (and have done) is to use a character variable for the
    >numeric, and simply use the move opcode in both programs. RPGII uses
    >signed numerics in parms and ILE and/or RPGIII/IV uses packed
    >numerics.
    >
    >Regards
    >Niels


    ga
    nospam@nospam.fmctc.com

  4. Re: RPGII call to RPG ILE pgm

    ga wrote:
    > Barbara Morris (or anyone else)
    >
    > I have a huge RPG II program I don't want to rewrite, but
    > unfortunately need to make a change in logic. I would like to call an
    > RPG ILE program from it and pass 3 parameters.
    >
    > Two of the parms are alpha and one is numeric (7/0)
    >


    If you code length 7 decpos 0 for RPG II, it means zoned(7,0). For RPG
    III and RPG IV, it means packed(7,0).

    Passing as character does work, and is sort of* necessary for RPG III,
    but it's not necessary for RPG IV. You can just define the RPG IV
    parameter as zoned numeric, and the parameter will pass just fine.

    You can code the RPG IV program like this, defining the parameter types
    in the D specs.

    D parm4 s 8a
    D parm5 s 8a
    D parm6 s 7s 0

    c *entry plist
    c parm parm4
    c parm parm5
    c parm parm6


    * For RPG III, I would define it as a data structure with a zoned
    subfield. That way, I could use the zoned value directly, without
    having to move it to/from a temporary.

    IPARM6D DS
    I 1 70PARM6
    C *ENTRY PLIST
    C PARM PARM4 8
    C PARM PARM5 8
    C PARM PARM6D

+ Reply to Thread