Hi we did it in a similar way.
We passed the caller program as parameter. If F03 was pressed then the Parameter is cleared if F12 is pressed the caller program is returned. In the caller program the returned program is compared with the current program. If it is the same then this program is continued if it is not the same (for example *Blank) then it is ended. In this way we could easily end multiple called programs or going back to a specific program.
Internally we did the same with different screens, i.e. we save the caller screen and then loop through the next screen (with a new name) as long as the Screen name is identical. If it is not the same the loop is ended and if F03 is pressed all loops were ended.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020

"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert Einstein)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Daniel Gross
Sent: Sunday, 10 August 2025 23:50
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: 5250 programming: F3, F12 and CALLed programs

Hi Patrik,

we use a char(2) parm that is passed to every interactive program, and it returns there a "return code".

Like "OK" for "I have done what you wanted" or "KC" for "user pressed F3".

In the case of "KC" the caller also ends with "KC" - and the caller of that caller also ends with "KC" ... and that goes on until the "root program" is reached, and that also ends with "KC" - but as it ends in a menu, there is nobody who cares about that.

That works through complete call stacks of procedures and programs - and is easy to understand and program.

HTH
Daniel


Am 10.08.2025 um 23:40 schrieb Patrik Schindler <poc@xxxxxxxxxx>:

Hello,

I'm rolling around this thought in my head for some time now and fail to come up with a convenient solution. So I thought, I ask: How did you do this, back in the days?

Assume an interactive application program is started from a menu. Within this application program, the user triggers some action which CALLs a secondary interactive program. The user eventually found what he searched for, and decides to cancel the whole task.

As far as I understood, F12 means "go back one step", and F3 means "go back further". Note: "further" is my term, I can't recall how IBM named it.
Some time ago, there was a discussion about the invention of the S/38 CPF in the Midrange-Main list. There were some links to historic documentation which in part was very enlightening to me. I found an explanation about F3 meaning "go back to the last menu". At least that's how I understood the text.

In the example above, the user would probably expect the F3 request to put him back to the menu he started the first application program from. So, to end a chain of application programs, the F3-Request needs to be passed on to the respective calling program, making it aware of the request, and making it end also. In turn the user's screen is displaying the last menu he navigated to.

Now I wonder what is the proper way to make the calling application aware about an ending request in a called program.

I have a guts feeling that this might be another case where I need to face my nemesis: Messages. Something I repeatedly fail to grok. Maybe I'm just too used to POSIX signals on Linux.

So if messages are the proper way to handle this, web links to examples would be very helpful. Maybe I can utilize learning by doing.

Thanks!

:wq! PoC

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.