Hi, James:
Yes, there are several ways to accomplish this.
1.
immediately after the SBMJOB command ,you can retrieve the
completion message CPC1221 from the job log of the current job, and
that gives you the qualified job name, e.g. "220931/MSW/DUMMY" from
which you can extract the components job #, user and job name --
issue DSPMSGD CPC1221 and select "2. Display field data" for
details. Then, given that information, you can use any one of a
number of APIs to find out the status of said job ... -or-
2. on the SBMJOB command, specify a message queue for the MSGQ
parameter. Prompt SBMJOB and F10=Additional parameters and page
down to the "MSGQ" parameter and press F1=Help to read about this.
The help text says: "Specifies the message queue to which a
completion message is sent when the submitted job has completed
running, either normally or abnormally." So then, you can just
"wait" on this message queue for a message to arrive. Note that this
message queue cannot be in QTEMP; it must be in a "real' library.
You could create a "temporary" message queue, such as:
CRTMSGQ MSGQ(QGPL/MSGQnnnnnn)
where "nnnnnn" is the current job #, just for this purpose. That
way, you should not have to worry about any other messages arriving
on this message queue. Once you are done waiting for that job to
complete, you may want to delete this "temporary" message queue.
Hope that helps,
Mark S. Waterbury
> On 7/22/2013 1:14 PM, James H. H. Lampert wrote:
Is there a way, from a CL program, to submit a batch job, and wait for
it to end before proceeding?
i.e.:
...
SBMJOB CMD(FOO) JOB(BAR)
<wait for BAR to finish>
<check the results from BAR>
...
--
JHHL
As an Amazon Associate we earn from qualifying purchases.