× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



John,

I prefer to use to the wonderful scope message API IBM provides,
designed specifically to accommodate such situations, e.g.

qmhsndsm ('*EXT':'EOJEXIT QGPL': Cmd: 128: MsgKey: Err);

The scope of *EXT means that once this procedure has been executed from
any program in the job then when the job is ending it will, in this
particular example, call program QGPL/EOJEXIT (from within the same
job). If necessary, the 3rd parameter can be used to pass a parameter
string to the program. The usage in this example is a sort of generic
EOJ event handler where the Cmd parameter could be any command string
chosen to be run whenever the job ends.

A typical use could be to pass a 'SBMJOB ....' statement to resubmit a
job that must always be running.
The EOJEXIT program can itself further condition it's response based on
whether the job end is *CNTRLD or *IMMED by checking the reason code via
the job API e.g.
CALL PGM(QUSRJOBI) PARM(&RCVVAR &VARLEN JOBI0400 '*' ' '
X'00000000')
CHGVAR &ENDREASON %BIN(&RCVVAR 501 4)

A message can also be scoped at a more granular level to operate when
either the program or call stack entry ends by specifying *PGM or *CSE.

Cheers, Peter


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Rusling
Sent: Wednesday, 20 May 2009 4:44 a.m.
To: 'rpg400-l@xxxxxxxxxxxx'
Subject: Detecting that a submitted batch job is ending from w/in an
RPGprogram.

I have an rpg program I want to use (submit to batch) as a 'monitoring'
program.
(in old elvish, an NEP program)

Within the program, there may be files, etc. open, at any time.

Since it's a submitted job, it'll be ended from the wrkactjob screen.

Since it may be possible to end it with *IMMED or *CNTRLD, I'm worried
about cleanup (files or objects getting released).

Is there a way to monitor, within the rpg program, for 'job ending'??
The rpg program will be in a constant loop state, waking up at set
intervals to do some processing. If I can trap a 'job ending' status,
I can close out the program/job gracefully.


John B

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-2024 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.