I have 10 Jobs stored in "abc.ef.jk" PDS.
now i want a rexx macro by which i can submit all 10 jobs but job2 gets executed only after the successful completion of JOB1.
can anybody help me out in this .
code snippets are most welcome
I presume you have a valid reason for wanting to do things this way, and that you're OK with the fact that you'll be tying up your TSO session.
Anyway, here's a rather generic process you can modify as you see fit.
1. When you submit the job, make sure you trap the jobname and number (jobid).
2. Use a loop to check for the job status with the TSO STATUS command:
and capture the output. You'll need to wait until you see the message:
"IKJ56192I JOB jobname(jobid) ON OUTPUT QUEUE".
3. Use the TSO OUTPUT command to retrieve the job output from the JES spool to a dataset:
"OUTPUT jobname(jobid) PRINT(dsname) BEGIN HOLD KEEP"
4. Read the OUTPUT command dataset. Look for the jobstep completion messages:
"IEF142I jobname [procstep] stepname - STEP WAS EXECUTED - COND CODE 0000"
You'll probably want to check for the highest return-code value from any of the steps. Take whatever action from that point.