Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to fetch Return Code of a JCL submitted through REXX ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Kunal Sharma

New User


Joined: 10 Feb 2012
Posts: 5
Location: India

PostPosted: Fri Feb 10, 2012 3:30 pm    Post subject: How to fetch Return Code of a JCL submitted through REXX ?
Reply with quote

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
View user's profile Send private message

Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Fri Feb 10, 2012 4:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kunal Sharma

New User


Joined: 10 Feb 2012
Posts: 5
Location: India

PostPosted: Fri Feb 10, 2012 4:10 pm    Post subject: Reply to: How to fetch Return Code of a JCL submitted throug
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Feb 10, 2012 4:21 pm    Post subject:
Reply with quote

Why not use Scheduling application like CA7 or control-m?
Back to top
View user's profile Send private message
Kunal Sharma

New User


Joined: 10 Feb 2012
Posts: 5
Location: India

PostPosted: Fri Feb 10, 2012 4:23 pm    Post subject: Reply to: How to fetch Return Code of a JCL submitted throug
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Feb 10, 2012 4:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kunal Sharma

New User


Joined: 10 Feb 2012
Posts: 5
Location: India

PostPosted: Fri Feb 10, 2012 4:33 pm    Post subject: Reply to: How to fetch Return Code of a JCL submitted throug
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Feb 10, 2012 4:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kunal Sharma

New User


Joined: 10 Feb 2012
Posts: 5
Location: India

PostPosted: Fri Feb 10, 2012 4:41 pm    Post subject: Reply to: How to fetch Return Code of a JCL submitted throug
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 10, 2012 5:01 pm    Post subject: Re: Reply to: How to fetch Return Code of a JCL submitted th
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Feb 10, 2012 5:16 pm    Post subject: Re: Reply to: How to fetch Return Code of a JCL submitted th
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 10, 2012 6:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Feb 10, 2012 8:10 pm    Post subject:
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Sat Feb 11, 2012 1:33 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us