Page 1 of 1

Show message on line 24 of interactive display after RPG program ends

Posted: Thu Jul 10, 2025 5:22 pm
by nelsong1997
Hello,

I am having trouble showing a message on line 24 of an interactive display that persists after an RPG program ends.

I was able to get this to work with SNDPGMMSG in a CL program.

Code: Select all

SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('EXAMPLE') TOPGMQ(*EXT) MSGTYPE(*COMP)
However, if I call this CL program from within an RPG program, the message goes away when the RPG program ends.

The closest I can get is to get a message to show on a separate screen with "Display Program Messages."

I was able to do this in two ways:

1. Calling a CL program that does a SNDPGMMSG like this:

Code: Select all

SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('EXAMPLE') TOPGMQ(*EXT) MSGTYPE(*INFO)
2. Using SND-MSG within the RPG program itself:

Code: Select all

SND-MSG *INFO 'EXAMPLE' %TARGET(*EXT); 


Is there any way to get the message to show on line 24, the same way it works with a CL program?

Please let me know if there is any more information I should provide about the scenario I am describing.

Thanks!

Re: Show message on line 24 of interactive display after RPG program ends

Posted: Wed Jul 16, 2025 10:08 pm
by Scott Klement
*COMP means "completion message" -- i.e. it is what shows when a program completes.

Since you have another program that is ending after the CL, it replaces it because now that program is completing. (Assuming I understand your scenario, anyway.)

You say you are able to see it if you do it as an *INFO message in a separate Display Program Messages screen -- that makes perfect sense since sending a program message to *EXT shows on that screen.

I guess you could retrieve the completion message from the CL program and re-send it as a completion message from the RPG program... it seems a little strange, but... I guess I wonder why you want to do this?

At any rate, the RPG program can do it like this (if you're up-to-date on PTFs):

Code: Select all

SND-MSG *COMP 'EXAMPLE' %TARGET(*CALLER: 1);
Support for SND-MSG to send *COMP messages was added (via PTF) in Spring 2024.

Re: Show message on line 24 of interactive display after RPG program ends

Posted: Thu Jul 17, 2025 2:41 pm
by nelsong1997
Thank you, that worked.

> I wonder why you want to do this?

Not for any really good reason. It was just driving me crazy because I knew it was possible somehow but I couldn't quite figure it out.

Thanks again