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

Reading values of JCL symbolic variables from REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ron Masters
Currently Banned

New User


Joined: 21 Dec 2011
Posts: 24
Location: UK

PostPosted: Fri Feb 17, 2012 8:21 pm
Reply with quote

I am writing a JCL PROC, and one of the things I need to do is build some control statements on the fly. To build them I would like to use REXX, and I would like to pass all the info required to build the statements to the exec as parms to the rexx exec. E.g.
Code:
//STEP0010 EXEC PGM=IRXJCL,PARM='MYEXEC &P1 &P2 &P3 &P4'

The problem is that this parm string will blow the limit of 100 characters allowed in the PARM= string on the JCL EXEC statement.

I could get around this if only my rexx exec could interrogate the calling job's JCL symbolic variables. Does anyone know if/how that can be done please?

Thanks
Ron[/code]
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Feb 18, 2012 1:42 am
Reply with quote

Read the proc/jcl asis? could you not pass your info via a dataset?
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sat Feb 18, 2012 2:14 am
Reply with quote

Maybe use the SDSF/Rexx interface to examine the job's JCL text while it is running?
Back to top
View user's profile Send private message
mtaylor

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Mon Feb 20, 2012 4:38 am
Reply with quote

I think he's wanting to get the SET values at run time. I don't think it's possible because all symbolic substitution is performed when the JCL text is read in. For example: there's an example in the manual that shows SET text altering a line such that what was a comment is turned into part of an executable statement (or the other way around, can't remember). Values are not carried thru to execution time. It's kind of the macro pre process in c/c++ if you're familar with that.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Feb 20, 2012 5:06 am
Reply with quote

Quote:
think he's wanting to get the SET values at run time.


the only way is to use SDSF REXX interface to read the JESJCL dataset
and use the info there ...
NO need for the parameters for the rexx script to be interpreted by the converter
it is enough to store the REXX parameters as comment cards and retrieve them from the jesjcl using something like

Code:
 EDIT       ENRICO.ISPF.EXEC(JESJCL) - 01.17                Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace  "O"                                                             
 000005 Parse Source _sys _how _cmd .                                           
 000006 parse arg args                                                         
 000007 args = space(args)                                                     
 000008 argc = words(args)                                                     
 000009                                                                         
 000010 jobid =  "JOB06970"                                                     
 000011 say "jobid " jobid                                                     
 000012                                                                         
 000013 jobid =  jobnumbr()                                                     
 000014 say "jobid " jobid                                                     
 000015                                                                         
 000016 IsfRC = isfcalls("ON")                                                 
 000017 if IsfRC ¬= 0 then do                                                   
 000018     say "isfcalls RC" IsfRC                                             
 000019     exit                                                               
 000020 end                                                                     
 000021                                                                         
 000022 isfprefix = ""                                                         
 000023 isfowner  = "*"                                                         
 000024 isffilter = ""                                                         
 000025 isffilter = "JOBID eq" jobid                                           
 000026 isfcols   = "jname jobid "                                             
 000027                                                                         
 000028 Address SDSF "isfexec da"                                               
 000029 if RC ¬= 0 then do                                                     
 000030     say "isfexec  RC" RC                                               
 000031     exit                                                               
 000032 end                                                                     
 000033 say "jname.0" jname.0                                                   
 000034 say "isfrows" isfrows                                                   
 000035                                                                         
 000036 do jnr = 1 to jname.0                                                   
 000037     say right(jnr,2) jname.jnr jobid.jnr                               
 000038     if jobid.jnr ¬= jobid then do                                       
 000039         say "SKIPPED " right(jnr,2) jname.jnr jobid.jnr                 
 000040         iterate                                                         
 000041     end                                                                 
 000042     say "PROCESS " right(jnr,2) jname.jnr jobid.jnr                     
 000043     jopts = "(PREFIX J)"                                               
 000044     Address SDSF "ISFACT DA TOKEN('"token.jnr"') PARM(NP ?) " jopts     
 000045     if RC ¬= 0 then do                                                 
 000046        say "isfact   RC" RC                                             
 000047        exit                                                             
 000048     end                                                                 
 000049     jdd = 2                                                             
 000050     say right(jnr,2) jname.jnr jobid.jnr right(jdd,2) jddname.jdd       
 000051                                                                         
 000052     Address SDSF "ISFACT da TOKEN('"jtoken.jdd"') PARM(NP SA) "         
 000053     "EXECIO * DISKR " isfddname.1 " ( OPEN FINIS STEM SPOOL. "         
 000054     do i = 1 to spool.0                                                 
 000055        say spool.i                                                     
 000056     end                                                                 
 000057     leave                                                               
 000058 end                                                                     
 000059                                                                         
 000060 call  isfcalls "OFF"                                                   
 000061                                                                         
 000062 exit
 000063                                                                         
 000064 Psa:      Procedure; Return                      '00'                   
 000065 Tcb:      Procedure; Return     C2x(Storage(X2x(Psa(), '21C'),4))       
 000066 Jscb:     Procedure; Return     C2x(Storage(X2x(Tcb(),  'B4'),4))       
 000067 Ssib:     Procedure; Return     C2x(Storage(X2x(Jscb(),'13C'),4))       
 000068 Jobnumbr: Procedure; Return         Storage(X2x(Ssib(),  'C'),8)       
 000069                                                                         
 000070 X2x:      Procedure; Return D2x(X2d(Arg(1))+X2d(Arg(2)))                       
 ****** **************************** Bottom of Data ****************************


wich when run with

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             REGION=0M,                                               
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000004 //*                                                                     
 000005 //S1      EXEC PGM=IRXJCL,PARM=JESJCL                                   
 000006 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000007 //SYSPRINT  DD SYSOUT=*                                                 
 000008 //SYSTSPRT  DD SYSOUT=*                                                 
 000009 //SYSTSIN   DD DUMMY                                                   
 ****** **************************** Bottom of Data ****************************


will return

Code:
********************************* TOP OF DATA **********************************
jobid  JOB06970                                                                 
jobid  JOB07020                                                                 
jname.0 1                                                                       
isfrows 1                                                                       
 1 ENRICO1 JOB07020                                                             
PROCESS   1 ENRICO1 JOB07020                                                   
 1 ENRICO1 JOB07020  2 JESJCL                                                   
        1 //ENRICO1  JOB NOTIFY=&SYSUID,                                       
          //             REGION=0M,                                             
          //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                     
          //*                                                                   
          IEFC653I SUBSTITUTION JCL - NOTIFY=ENRICO,REGION=0M,MSGLEVEL=(1,1),CLA
        2 //S1      EXEC PGM=IRXJCL,PARM=JESJCL                                 
        3 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
        4 //SYSPRINT  DD SYSOUT=*                                               
        5 //SYSTSPRT  DD SYSOUT=*                                               
        6 //SYSTSIN   DD DUMMY                                                 
******************************** BOTTOM OF DATA ********************************


a bit more complicated setup, but which will let the REXX script see the PROC parameters passed

the trick is to use some <dummy> SET statements

here is the jcl

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             REGION=0M,                                               
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000004 //*                                                                     
 000005 //ZPROC   PROC PA1=SSS,PA2=YYYY                                         
 000006 // SET ZPA1=&PA1                                                       
 000007 // SET ZPA2=&PA2                                                       
 000008 //S1      EXEC PGM=IRXJCL,PARM=JESJCL                                   
 000009 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000010 //SYSPRINT  DD SYSOUT=*                                                 
 000011 //SYSTSPRT  DD SYSOUT=*                                                 
 000012 //SYSTSIN   DD DUMMY                                                   
 000013 //        PEND                                                         
 000014 //*                                                                     
 000015 //RUN1    EXEC ZPROC,PA1=QWQW,PA2=ZXZX                                 
 ****** **************************** Bottom of Data ****************************


and here the result

Code:
********************************* TOP OF DATA **********************************
jobid  JOB06970                                                                 
jobid  JOB07022                                                                 
jname.0 1                                                                       
isfrows 1                                                                       
 1 ENRICO1 JOB07022                                                             
PROCESS   1 ENRICO1 JOB07022                                                   
 1 ENRICO1 JOB07022  2 JESJCL                                                   
        1 //ENRICO1  JOB NOTIFY=&SYSUID,                                       
          //             REGION=0M,                                             
          //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                     
          //*                                                                   
          IEFC653I SUBSTITUTION JCL - NOTIFY=ENRICO,REGION=0M,MSGLEVEL=(1,1),CLA
        2 //ZPROC   PROC PA1=SSS,PA2=YYYY                                       
          // SET ZPA1=&PA1                                                     
          // SET ZPA2=&PA2                                                     
          //S1      EXEC PGM=IRXJCL,PARM=JESJCL                                 
          //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
          //SYSPRINT  DD SYSOUT=*                                               

          //SYSTSPRT  DD SYSOUT=*                                               
          //SYSTSIN   DD DUMMY                                                 
          //        PEND                                                       
          //*                                                                   
        3 //RUN1    EXEC ZPROC,PA1=QWQW,PA2=ZXZX                               
        4 ++ZPROC   PROC PA1=SSS,PA2=YYYY                                       
        5 ++ SET ZPA1=&PA1                                                     
          IEFC653I SUBSTITUTION JCL - ZPA1=QWQW                                 
        6 ++ SET ZPA2=&PA2                                                     
          IEFC653I SUBSTITUTION JCL - ZPA2=ZXZX                                 
        7 ++S1      EXEC PGM=IRXJCL,PARM=JESJCL                                 
        8 ++SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
        9 ++SYSPRINT  DD SYSOUT=*                                               
       10 ++SYSTSPRT  DD SYSOUT=*                                               
       11 ++SYSTSIN   DD DUMMY                                                 
******************************** BOTTOM OF DATA ********************************


the trick is to scan for the IEFC653I SUBSTITUTION JCL and process accordingly
Back to top
View user's profile Send private message
Ron Masters
Currently Banned

New User


Joined: 21 Dec 2011
Posts: 24
Location: UK

PostPosted: Mon Feb 20, 2012 5:20 pm
Reply with quote

As a colleague pointed out to me on saturday, the SET variables will have been disposed of by the time the reader/interpreter has finished, and so they won't be available at run time except in the SDSF output.

I think the simplest thing for me to do will be to split up the parms into manageable chunks, and have a couple of steps prior which write them to a temporary dataset. My main exec can then just read them in from there.

I'll consider this thread closed now. Many thanks to all contributors, especially Enrico who seems to have spent quite a lot of effort on it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Feb 20, 2012 5:32 pm
Reply with quote

Quote:
Enrico who seems to have spent quite a lot of effort on it.


not too much really, I had already posted some snippets on how to use the REXX SDSF interface

I just had to add ( from my tools chest ) the lines to get the jobnumber

and the couple of statements to add the filter stuff read only the JESJCL dataset

side note ...
it is strange that the redbook downloadable snippets did not use the isffilter variable
but scanned all the jobs comparing the for example jobname and jobnumber (jobid)
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Sun Mar 04, 2012 11:53 pm
Reply with quote

we use a jcl extension (a SUBSYS), that allows to cirumvent the 100 char jcl symbol parm-limit. in this case (IRXJCL) i can code the call in DD:SYSTSIN with this special subsys. symbolic substition works. max parm-length is practically unlimited.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top