Checking if a job, which has a record lock, is doing anything before ending it

pts.
Tags:
RPG
We have some RPG code which will end a job if it has a record lock, but I would like to be sure that the job is not 'active' (not doing anything) before doing so. Is this sort of detail available via an API call ? Any examples would be gratefully received.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

I’m not quite sure I understand what you’re getting at. As far as the Operating System would be concerned the job would be *ACTIVE as it is waiting for a record lock to be released.

As the job would be in a LCKW status, the implication is that it would not actually be doing anything at the time although the job could be in the middle of a transactional process (i.e. some files may have been updated, but others not) in which case ending the job could leave you with half completed transactions in your database.

If that is the sort of thing you want to guard against then you need to look into the use of journals and commitment control. This would allow you to update all files in a transaction set and then commit the updates to the database once they have all been made. Should the job end before the commitment step is done, the updates would be rolled back out of the files and you would need to recreate the entire transaction.

All the best

Jonathan

===================================================================

You possibly want the Retrieve Job Information (QUSRJOBI) API for format JOBI0200. Look for ‘Active job status’. One of the most likely statuses that could indicate the job isn’t doing anything might be DSPW “Waiting for input from a work station display”.

You’ll have some decisions to make about what it means not to be ‘doing anything’.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TheQuigs
    You can use the QUSRJOBI api documented at: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/qusrjobi.htm to retrieve the Processing unit time used. (This is returned by format JOBI0150.) I would check the time used, then check again after a brief delay and see if the time used has increased. If it has, the job is defintely actively doing something.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following