Status of a submitted AS/400 job

2505 pts.
Tags:
AS/400 jobs
RTVJOBA
SBMJOB
This is the scenario, I want my job B to start after finishing Job A and Job C to start after finishing Job B. Can I use a RTVJOBA to check whether job A has finished sussesfully so that I can submit Job B? If I can use this, which paramter will tell me the job status like successfully completed or not.?

Software/Hardware used:
AS400

Answer Wiki

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

Once you submit job by using SBMJOB command, You can be able to find the Job Running in Batch Jobs and as well you can find the same in WRKSBMJOB(you can find the latest one at the bottom(Shift+F6)).

As soon as you submit the Job, the status will be in JOBQ(waiting to run),
While Job running in BATCH the status will be in ACTIVE(currently in progress),
After the Job finished, The status of the Job will be ‘OUTQ’

So, You can consider the Job has finished when the status becomes OUTQ.
If you want to see the details of that Job, You can use option 5(Work with), You can see the Job status Attributes and Job log in detail.

Pradeep.

Discuss This Question: 11  Replies

 
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
  • CharlieBrowne
    This question gets asked about once a year. You must have the same instructor at school. You will find other answers if you search the archives. BTW, one option is to have PGM A, do a SBMJOB or CALL to PGM B upon sucessful completion and the same with B SBMJOB of C
    41,380 pointsBadges:
    report
  • RamvishakRamesh
    Thanks for the reply, but my aim is to handle it from CL program itself. I cannot depend on WRKSMBJOB in that case right? In my CL program, I am doing SBMJOB to submit job A, Once A is sussessfully completed, then only I need to submit B and so on. How to do that from program?
    2,505 pointsBadges:
    report
  • TomLiotta
    The SBMJOB MSGQ() parameter has this help text:
    • Specifies the message queue to which a completion message is sent when the submitted job has completed running, either normally or abnormally. If an abnormal ending occurs, the help information for the completion message specifies the possible causes.
    The purpose of that parameter is so that the submitting job can monitor the submitted job and be notified when the job completes, and be notified about some conditions of the completion. If you want JobA to submit JobB and to know when JobB completes, then submit JobB with a message queue specified. After the SBMJOB command completes, just have JobA wait for a completion message to arrive at the specified message queue. Create a simple message queue in the application library and name it MONJOBB, or whatever name makes sense. Use that message queue just for this purpose. Tom
    125,585 pointsBadges:
    report
  • Runelf
    You could submit Job A, then Job B then Job C from one CL and us a single threaded JOBQ. The second job will not go active until the first has completed, and the same for the third.
    40 pointsBadges:
    report
  • iiiiiiiiiiiii
    write a cl program...first call program A and then call program B and then call program C. So after completion of Program A only program B will execute and so on. I hope u got my answer. Thanks priya
    335 pointsBadges:
    report
  • pdraebel
    Submitting the jobs at one time to a single threaded Jobq will work, but not if you want to make sure the job completes successfully. Tom's sugeestion might open more options for that puurpose.
    3,090 pointsBadges:
    report
  • DanTheDane
    You may find your solution in my answer to RBDSILVA in an old Q dated aug 19., 2009: http://itknowledgeexchange.techtarget.com/itanswers/cl400-with-restart-option/ Happy Coding DanF
    2,555 pointsBadges:
    report
  • TomLiotta
    Can I use a RTVJOBA to check whether job A has finished... No. RTVJOBA can only be used by a job to find out things about itself. It can't be used to find out about any other job. The simplest way to find the status of a submitted job is by calling the Retrieve Job Status (QWCRJBST) API. But that will only tell you if the job has finished; it won't tell you if it was a successful completion. And in order to call that API, you will need to know enough to identify which job the API should return status for. When your program submitted the other job, a CPC1221completion message was sent to your program's message queue. You can use the RCVMSG command to receive that message and then extract the fully qwualified job name from the message data. You'll need to use that message data for just about any function that will return status information about a job that you submitted. One function that you won't need to use that message data for is if you simply receive messages from the message queue that you specify in the SBMJOB MSGQ() parameter. Sufficient status information will simply appear in the message queue as soon as its available from the system -- assuming that all you need to know is whether the job is finished yet and whether it failed or not. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    If I could modify the CL's then I would co-ordinate this through a data area When JobA starts it updates the data area with 'JOBA STARTING' The last step JobA updates the data area with 'JOBA ENDED SUCCESSFULLY' The First Step of JobB checks the value in the data area if it contains'JOBA ENDED SUCCESSFULLY' continue with JobB else send message and ??? wait/end??? The second step of JobB updates the data area with 'JOBB STARTING' The last step of JobB updates the data area with 'JOBB ENDED SUCCESSFULLY' The First Step of JobC checks the value in the data area if it contains 'JOBB ENDED SUCCESSFULLY' continue with JobC else send message and ??? wait/end??? The second step of JobC updates the data area with 'JOBC STARTING' The last step of JobC updates the data area with 'JOBC ENDED SUCCESSFULLY' Phil
    50,860 pointsBadges:
    report
  • TomLiotta
    If I could modify the CL’s... That's true. But since the message queue support doesn't require modifying the submitted jobs, why do it? The message queue can hold thousands of messages. The submitted jobs may even send their own status (tracking? debug?) messages if modification is possible. Sending one message doesn't erase previous messages as would happen with a data area. And unless the data area is expanded to hold more info that the submitted CL must format and put there, there's no identification of the source nor the time. A message will automatically include sender identification and timestamp. So, simply by specifying a message queue on the SBMJOB command, the base actions are all handled automatically by the system. Once the base is in place, it can be expanded for almost any future need. I would use CRTMSGQ with MSGQFULL(*WRAP) to allow the queue to wrap if there was ever any reason that messages might not be received from it for an extended time. Tom
    125,585 pointsBadges:
    report
  • RamvishakRamesh
    [...] Status of a submitted AS/400 job [...]
    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