Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CALL OPM with differ lenght

Status
Not open for further replies.

thelearner

Programmer
Jan 10, 2004
153
US
Hi,

I have an OPM program with 2 parms (6x and 35x).
Inside my ILE pgm I have a field, 25x long, that I want to used for 2nd parm when I call this OPM pgm. The OPM pgm suppose to change the value of the 2nd parm and pass back to the calling pgm. Is it possible? HOW?
I tried this but it did not chg the value of ZPRCD after the call return.
D IQPROD PR
D XCUCODE 6
D XPRCD 35 OPTIONS(*VARSIZE)

XPRCD is a field from Display screen and it's 25X.

Thanks in advance
 
Take out the OPTIONS(*VARSIZE) keyword.

Here is an example (which works):
Code:
      * Send Error Message With Data                         
     D Send_Msgq_2     PR                  Extpgm('SNDMSG2') 
     D  Msgid                         7A   Const             
     D  Errormsg                     30A   Const             


      * Invalid G/L.   
     C                   Callp     Send_Msgq_2('AR00761':'Bad GL Account Number')

Here is the CL program SNDMSG2:
Code:
 PGM        PARM(&MSGID &MSGDTA)                       
 DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)             
 DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(100)          
 MONMSG     MSGID(CPF0000)                             
 OVRMSGF    MSGF(SYSMSGF) TOMSGF(ARQCOBJ/QCMSGF)       
 OVRMSGF    MSGF(QCMSGF) TOMSGF(ARDEV/DEVMSGF)         
 SNDPGMMSG  MSGID(&MSGID) MSGF(SYSMSGF) MSGDTA(&MSGDTA)
 ENDPGM

The called program can have a longer parameter length than the calling program - you don't need the OPTIONS(*VARSIZE) keyword.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
Hi,

Thank, but I want to pass variable not the litteral value.
 
by the way doesn't the keyword CONST tell it not to change the parm value?
My calling pgm will pass '?' (using 2nd PARM) to the pgm in OPM. In OPM pgm I will select one I item and that item will be put in the 2nd parm, replace '?'. So after the call return I expect to see the new value.
 
You may get this to work, but mixing OPM and ILE like this causes a host of problems. Best to make both ILE (or both OPM). The activation groups here are bound to cause problems.
 
* Prototype definition
D IQPROD PR EXTPGM('MYOPMPGM')
D 6
D 35
...
* Variables definition
D XCUCODE S 6
D XPRCD S 35

...
C EVAL XPRCD = MY25CHARFLD
C CALLP IQPROD(XCUCODE: XPRCD)
...

And that's all. Philippe --
 
Thanks Talkturkey, but I was looking for passing the the variable MY25CHARFLD in the parm directly, without this line.
C EVAL XPRCD = MY25CHARFLD





 
Try this, it should work. Let me know pls.
Notice I've changed the XPRCD length and removed the EVAL stm. It was here just for sake of safety.

Code:
* Prototype definition
D  IQPROD           PR      EXTPGM('MYOPMPGM')
D                        6
D                       25 

 * Variables definition
D XCUCODE     S           6
D XPRCD       S          25 


C            CALLP  IQPROD(XCUCODE: XPRCD)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top