IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> CLIST & REXX
Post new topic   This topic is locked: you cannot edit posts or make replies.
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
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
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
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: 1742
Location: Tirupur, India

PostPosted: Fri Feb 10, 2012 4:21 pm
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
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: 1742
Location: Tirupur, India

PostPosted: Fri Feb 10, 2012 4:28 pm
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
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: 1742
Location: Tirupur, India

PostPosted: Fri Feb 10, 2012 4:35 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 10, 2012 5:01 pm
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: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 10, 2012 5:16 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 10, 2012 6:13 pm
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: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 10, 2012 8:10 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Feb 11, 2012 1:33 pm
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
Anees Ahmed

New User


Joined: 17 Nov 2020
Posts: 1
Location: Singapore

PostPosted: Tue Nov 17, 2020 10:19 pm
Reply with quote

Hi Kunal, I have the exact same requirement as you.. found an answer to your query ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Tue Nov 17, 2020 11:07 pm
Reply with quote

@Anees: Start your own thread as there have been serious enhancements in the past eight years. For sure this topic will be locked soon.. icon_exclaim.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top