Page 1 of 1

Return code of step in JOB

PostPosted: Wed Mar 26, 2008 1:08 pm
by Chaitnya
Hi,

Can any one tell me how to store the return code of particular job step into a PS file :!:

Thanks

Re: Return code of step in JOB

PostPosted: Wed Mar 26, 2008 4:26 pm
by MrSpock
From within the job while it is still running?

You have to retrieve that from the job's JSCB (Job Step Control Block) in the MVS Common Data Area.

Re: Return code of step in JOB

PostPosted: Wed Mar 26, 2008 8:25 pm
by dick scherrer
Hello Chaitnya and welcome to the forums,

Can any one tell me how to store the return code of particular job step into a PS file
As a beginner, you will probably not be able to do this. There is no "standard" jcl that will capture some previous return code and store it in a file.

As was mentioned, you would need to use the system control info and this is typically not something a beginner would do.

Why do you want the rc in a file? If we understand your requirement, we may be able to offer suggestions.

Re: Return code of step in JOB

PostPosted: Sat Apr 19, 2008 12:25 pm
by Chaitnya
Hi dick,

I have to check the Return code of previous JOB and then have to decide the next job need to execute or not.

So I am thinking to note down the return code of the JOB in PS file after it's execution. and in next job by reading return code from PS file deciding to run it or not.

Re: Return code of step in JOB

PostPosted: Sat Apr 19, 2008 12:51 pm
by dick scherrer
Hi Chaitnya,

There is no single "return code" for a job. Each step generates a return code (most are zero, but they are still created as each step ends).

Your requirement is usually handled by the scheduling software. The "second" job is defined such that it will automatically run on the successful completion of the "first" job. If you talk with the people responsible for system scheduling, they can help you properly define your jobs and their successor/predecessor jobs.

Re: Return code of step in JOB

PostPosted: Sat Apr 19, 2008 2:41 pm
by arunprasad.k
Yes as Dick clearly said, scheduler is the best way and possibly the simplest and safest way to track the jobs.

But if you are want this for some testing (no not for production env), you can use INTRDR and submit the job.

Suppose job B should run only if job A's STEP03's RC is 5, then in the last step of job A have a INTRDR statement with condition parameters.

But I would strongly recommend you not to do this for production jobs.

Arun.