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

Evaluate variable to execute a jcl step

IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message

New User

Joined: 05 Oct 2022
Posts: 3
Location: Spain

PostPosted: Fri Oct 21, 2022 5:51 pm
Reply with quote

Hi there!!

I'm trying to evaluate a variable in order to execute one step in a jcl or another distinct step in the same jcl.

I've tried with IF/THEN/ELSE but with this method i can't evaluate variables, only RCs

I pass the variable through CONTROL-M and it can take two possibles values, PROG or DSN. And depending of these values i have to execute one step for PROG or another step for DSN

Any idea???

Thanks a lot!!!!
Back to top
View user's profile Send private message

Senior Member

Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Fri Oct 21, 2022 6:24 pm
Reply with quote

If you want to get a response, please, be polite to the members of this forum:

1) Learn how to use the Code button when posting messages

2) Present here your input data (using Code button)

3) Present here your own code (using Code button)

4) Present here your desired output (using Code button)

5) Present here your actual output data (using Code button)

6) Present here all and every error/warning message, and/or error code received.

If not, you can continue your postings as long as you wish.
Back to top
View user's profile Send private message
Willy Jensen

Active Member

Joined: 01 Sep 2015
Posts: 720
Location: Denmark

PostPosted: Fri Oct 21, 2022 6:36 pm
Reply with quote

This small REXX might help:
/*                                                           rexx         
 Set return code                                                           
 the parm value if the parm is a number                                   
 else assume parm is a test, set rc:                                       
   0 if test is true                                                       
   1 if test is false                                                     
   multiple test can be combined                                           
 Samples expressions                                                       
 Sample job                                                               
  //SETRC0   EXEC PGM=IKJEFT1B,PARM='SETRCX translate(date(W))=FRIDAY'     
  //SYSEXEC  DD DISP=SHR,DSN=...                                           
  //SYSTSPRT DD DUMMY                                                     
  //SYSTSIN  DD DUMMY                                                     
 if datatype(arg(1))='NUM' then return arg(1)                             
 /* set internal variables */                                             
 parse value time() with $th':'$tm':'$ts                                   
 $dmon    = translate(word(date(),2))       /* month name i.e. FEB   */   
 $day     = translate(left(date('w'),3))    /* day of week, i.e. TUE */   
 parse value date('s') with $ymd 0 $dyyyy +4 $dmm +2 $ddd 0 . +2 $dyy +2 .
 $dmy     = $ddd''$dmm''$dyy                                               
 $ymd     = $dyy''$dmm''$ddd                                               
 $jesnode = sysvar('sysnode')                                             
 $sysname = mvsvar('sysname')                                             
 $sysplex = mvsvar('sysplex')                                             
 $jobname = mvsvar('symdef','jobname')                                     
 signal on syntax                                                         
 signal on error                                                           
 Interpret "cc=("arg(1)")"                                                 
 return cc=0                                                               
 return 99                                                                 
 /* speciel builtin functions */                                           
Symbol:  return mvsvar('symdef',arg(1))     
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator

Joined: 21 Sep 2010
Posts: 3066
Location: NYC,USA

PostPosted: Sat Oct 22, 2022 10:16 pm
Reply with quote

You can use DFSORT using JPn to set RC based on what values you get and use IFTHEN LATER.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top