View previous topic :: View next topic
|
Author |
Message |
Kunal Sharma
New User
Joined: 10 Feb 2012 Posts: 5 Location: India
|
|
|
|
Hi All,
I am submitting a series of JCLs ( Batch Jobs ) through a rexx code.
I need to analyze the return code of the JCL submitted.
What is the command or function which can help in fetching return code of JCL submitted ? |
|
Back to top |
|
|
Stefan
Active User
Joined: 12 Jan 2006 Posts: 110 Location: Germany
|
|
|
|
Hi Kunal,
you should rethink your application design seriously!
It's no good idea to wait for the end of batch jobs. Submitting batch jobs is starting asynchronous tasks. You cannot predict when these will end. How long do you want to wait in your application? One second, one minute, forever?
Instead split your application in two parts. The first part submits the jobs and stores their job names and job numbers somewhere. Then it's up to a user to start the second part of your application. This part will then examine the SDSF queues and determine the current status of all of these jobs whos name and numbers have been stored by the previous part of your application.
DO NOT WAIT for a specific status. Just catch the current status and show it to the user. You might design an ISPF dialog which displays this information in a tabular list and refreshes the data whenever the user presses ENTER.
If you don't know how to find out the current status of a batch job, simply catch the output of the TSO STATUS command using the OUTTRAP() function in REXX. For a more elaborate approach you could use the REXX/SDSF environment to retrieve job information from the SDSF server.
Another technique would be to let the single jobs write their status to a dataset or a database. But with this approach you don't know if the fact that a job status has not yet been written is caused by an execution delay or by an abnormal job end.
What comes in mind as a third approach is letting the jobs submit its follower as the very last step. Each job should also have a step with COND=ONLY which informs you that the chain of jobs have been interrupted by a severe abend. Only the last jobs has a final step which informs you about the successful completion. |
|
Back to top |
|
|
Kunal Sharma
New User
Joined: 10 Feb 2012 Posts: 5 Location: India
|
|
|
|
Thankyou Stefan for your valuable inputs.
The idea is to write a rexx code which can submit a series of jobs which are dependent on other jobs.
For example :
We have three jobs - job1, job2, job3
If job1 returns maxcc=0 then only job2 should be submitted
If job2 returns maxcc=0 then only job3 should be submitted
What should be done in such a case ? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Why not use Scheduling application like CA7 or control-m? |
|
Back to top |
|
|
Kunal Sharma
New User
Joined: 10 Feb 2012 Posts: 5 Location: India
|
|
|
|
Hi vasanthz,
I am preparing this for test region and not for production region where CA7 or control-m can be readily used. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Make last step of job1 submit job2 and
last step of job2 submit job3, with suitable COND parameter.
Code: |
//LASTSTEP EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
SUB 'WELLS.LOCATION(JOB2)'
/* |
Quote: |
Each job should also have a step with COND=ONLY which informs you that the chain of jobs have been interrupted by a severe abend. |
also you have to take care of this scenario if there is an abend in one of the jobs. |
|
Back to top |
|
|
Kunal Sharma
New User
Joined: 10 Feb 2012 Posts: 5 Location: India
|
|
|
|
I need to submit the JCL through REXX code by taking input as a PS file which shall contain names of all jobs to be submitetd. Also submitting a job at end of first job does not ensures that the previous job has completed successfully |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Quote: |
Also submitting a job at end of first job does not ensures that the previous job has completed successfully
|
Thats the reason I mentioned "with suitable COND parameter." |
|
Back to top |
|
|
Kunal Sharma
New User
Joined: 10 Feb 2012 Posts: 5 Location: India
|
|
|
|
The PS file should contain names of all JCLs like Job1, Job2 and Job3. The way out you are suggesting i shall have to embed the name of dependent jobs in their respective predecessors.
Is there a way out with which i can simply specify files and they are run on basis on RC of previous job (keeping in mind the dependency factor)? |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Kunal Sharma wrote: |
Hi vasanthz,
I am preparing this for test region and not for production region where CA7 or control-m can be readily used. |
Thats a load of crap, a test environment has to be a mirror of a production environment. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
PeterHolland wrote: |
Kunal Sharma wrote: |
Hi vasanthz,
I am preparing this for test region and not for production region where CA7 or control-m can be readily used. |
Thats a load of crap, a test environment has to be a mirror of a production environment. |
Bat puckey. "Should be", maybe; "is", never in my experience save where people are stupid and/or reckless enough to run tests in the production environment.
That said, you still have some seriously bad ideas, Kunal Sharma. Start with the Rexx code presented here, and customize for your needs. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Quote: |
Bat puckey. "Should be", maybe; "is", never in my experience save where people are stupid and/or reckless enough to run tests in the production environment
|
huh? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
PeterHolland wrote: |
Quote: |
Bat puckey. "Should be", maybe; "is", never in my experience save where people are stupid and/or reckless enough to run tests in the production environment
|
huh? |
Did I stutter? These days test environments are on separate LPARs, perhaps physically separate machines. Test environments are scanted in terms of resources; one of the common things that they lack is a scheduler. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
You didnt stutter, your sentence structure was too difficult for me.
The company i worked for had test environments (plural) equiped with
everything the production systems had.
Maybe that made me very spoilt. |
|
Back to top |
|
|
Anees Ahmed
New User
Joined: 17 Nov 2020 Posts: 1 Location: Singapore
|
|
|
|
Hi Kunal, I have the exact same requirement as you.. found an answer to your query ? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1329 Location: Bamberg, Germany
|
|
|
|
@Anees: Start your own thread as there have been serious enhancements in the past eight years. For sure this topic will be locked soon.. |
|
Back to top |
|
|
|