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

Discussions relating to writing software in ILE RPG (RPG IV). This includes both fixed and free format RPG.
Post Reply
nelsong1997
Posts: 1
Joined: Thu Jul 10, 2025 5:00 pm

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

Post 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!
Scott Klement
Site Admin
Posts: 890
Joined: Sun Jul 04, 2021 5:12 am

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

Post 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.
Post Reply