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
 

 

Using the return code of a jobstep as a variable in another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
KY2000

New User


Joined: 01 Apr 2006
Posts: 2

PostPosted: Sat Apr 01, 2006 1:44 am    Post subject: Using the return code of a jobstep as a variable in another
Reply with quote

Here is what I am trying to accomplish:
If say Job Step 10 gets a return code of 12, I have Job step 20 that only runs if JS010 RC > 8. However, JS020 executes a program that will insert a row to a Database and I want to capture the Return code value from JS010 and pass it to the program as a parm?

Any thoughts?

Thanks,
Ken
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Apr 01, 2006 2:00 am    Post subject: Re: Using the return code of a jobstep as a variable in anot
Reply with quote

A few:

1. Easiest. Don't do this.

2. Easier. Have the program in JS010, as it performs the "MOVE 12 TO RETURN-CODE" before it ends also write this information to an output dataset, which can then be read and used by the program in JS020.

3. Harder. Have the job end after JS010. Use a tool to read the job statistics from the JES spool (i.e. SDSF, IOF, Sysview), or run a query against your job scheduler, and retrieve step JS010's return-code value. Store that value, and pass in to another job that will start with the program that is currently your JS020 step.

4. Hardest. Code a program that reads the MVS Control Block information from JS010, find the offset where the value for the RETURN-CODE register for JS010 is located, write that value to a dataset, and then have the program in JS020, again, read that dataset.
Back to top
View user's profile Send private message
KY2000

New User


Joined: 01 Apr 2006
Posts: 2

PostPosted: Sat Apr 01, 2006 2:10 am    Post subject: Re: Using the return code of a jobstep as a variable in anot
Reply with quote

I figured that this was not going to be an easy task. I think I will go with your easiest path suggestion and just pass a parameter indicating an error instead of the specific level.

thanks!!
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Apr 01, 2006 2:18 am    Post subject: Re: Using the return code of a jobstep as a variable in anot
Reply with quote

Actually, another option just occured to me.

Don't run these two steps in batch. Instead, run them within a script (CLIST or REXX) so you can trap and control the return-code values. As an example, using pseudo-code:

START

CALL PROGRAM1 <= Run JS010 program
SET &RETCODE = RC <= Trap the RETURN-CODE value in a variable &RETCODE

CALL PROGRAM2 '&RETCODE' <= Run JS020 program with the variable for a parameter.

EXIT
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
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


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