25 pts.
 Need to know whether a job is completed
Hi,

I need to submit 2 jobs JOB 1 and JOB2 but before doing a sbmjob on JOB2 i should make sure that JOB 1 has ended. How can i do that during program execution.

Thanks.



Software/Hardware used:
ASKED: November 4, 2009  9:16 AM
UPDATED: November 6, 2009  12:20 AM

Answer Wiki:
The easiest way is to submit them at the same time to a job queue that is single thread. If all you job queues allow multiple jobs running at the same time, you can set one of the priority levels in the job queue to be single thread. == Another option is to submit job2 from job1. == There are many other ways, but they are not as straight forward. Let us know if the above options will not work for you and we can put out more ideas. ===================================================== Assuming JobA wants to submit JobB, and then submit JobC after JobB finishes -- The SBMJOB JOB( JOBB ) command will cause a CPC1221 *COMP message to be sent to the program in JobA. That completion message can be received and info about JobB can be extracted from it. The fully-qualified name of JobB is particularly useful. Also, there is a SBMJOB MSGQ() parameter that tells the name of the message queue that you want messages about JobB to be sent. When JobB finishes, a message will be sent to that message queue telling about how JobB ended. The default parameter value is SBMJOB MSGQ( *USRPRF ). I.e., a message will be sent to the user profile message queue for whichever user submitted the job. When you run a SBMJOB command, you should see a message in your message queue when the job ends -- try it. You can name any message queue you choose on the MSGQ() parameter. So, the CPC1221 gives you the fully-qualified job name. You can use that to retrieve the status of the job at any time. And the MSGQ() gives something you can monitor for, like a signal. When a message arrives on the queue, you can receive it and decide what action to take next, e.g., submit JobC. Tom
Last Wiki Answer Submitted:  November 6, 2009  12:20 am  by  CharlieBrowne   33,730 pts.
All Answer Wiki Contributors:  CharlieBrowne   33,730 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _