Re: If an RPG program is forcibly terminated . . .

Jon Paris <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
On-Exit was introduced in 7.2, so, not surprising that it is not in your docs.  Are you really running 7.1, or is it just the manuals that are outdated?

One thought - if performance is an issue in this application, calling the usleep() or sleep() functions is more efficient than DLYJOB.


Jon Paris
[email protected]



> On Sep 9, 2025, at 5:51 PM, James H. H. Lampert via RPG400-L <[email protected]> wrote:
> 
> On 9/9/25 11:25 AM, Daniel Gross wrote:
>> A) if the program check for %SHTDN() regularly it can sense the *CNTRLD job ending.
>> B) if you write a procedure the ON-EXIT procedure gets executed even when the job ends *IMMED
>> C) this can also be done via APIs for "traditional" programs (CERRTX) and even for service programs (CEE4RAGE2 - when the activation group ends).
> 
> Dear Mr. Gross:
> 
> Thanks.
> 
> Option A has the problem that I can't be sure it's not going to be *IMMED.
> 
> Option B has the problem that this is a Cycle program, and the additional problem that I can't find any "ON-EXIT" in any of my RPG docs (including the V7R1 reference).
> 
> So I went with Option C, and I found Joe Pluta's article on how to use it, on mcpressonline.com. A test program (that rides The Cycle through a file, shelling out a one-second DLYJOB for each record via QCMDEXC) has given me proof-of-concept.
> 
> --
> JHHL
> -- 
> This is the RPG programming on IBM i (RPG400-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/rpg400-l.
> 
> Please contact [email protected] for any subscription related questions.
> 

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

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.