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 CPF1241 completion 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.