I have a cl program thats call rpgle program. The rpgle program produces a dsply "message" I want to set the dsply message as a variable in the cl program used to call the rpgle pgm.
What cl command to retrieve the dsply message to a variable?
I have a cl program thats call rpgle program. The rpgle program produces a dsply "message" I want to set the dsply message as a variable in the cl program used to call the rpgle pgm.
What cl command to retrieve the dsply message to a variable?
The DSPLY
op-code sends a Information
message...
Take a look at the Receive Message (RCVMSG) has mentioned in the Receiving messages into a CL procedure or program section of the CL Programming documentation.
My understanding here is that you're trying to change a variable within a CL program via a call to an RPG program.
Let's ignore DSPLY for now as my guess is that you don't actually need it.
Example CL program (MYCLPGM) that sets a variable to "Apple", calls an RPG program changing said variable to "Orange" and displays the resulting variable's value as a message in the job log (and in the message area on screen, depending on your emulator);
PGM
DCL VAR(&MYVAR) TYPE(*CHAR) LEN(10)
/* Change variable "&MYVAR" to "APPLE" */
CHGVAR VAR(&MYVAR) VALUE('APPLE')
/* Call RPG program to change "&MYVAR" to "Orange" */
CALL PGM(MYRPGPGM) PARM(&MYVAR)
/* Send message to job log showing what &MYVAR now contains */
SNDPGMMSG MSG('&MYVAR = ' || &MYVAR)
ENDPGM
Example RPGLE program (MYRPGPGM) to change variable;
d MYRPGPGM pr extpgm('MYRPGPGM')
d myVar 10a
d MYRPGPGM pi
d myVar 10a
/free
// Change passed in variable "myVar" from "Apple" to "Orange"
myVar = 'Orange';
// Return to caller
return;
/end-free