Page 1 of 1

TSO/E Rexx and JCL to get DSN from DD Name

PostPosted: Tue Jan 26, 2016 10:35 pm
by papadilbert
I need to submit a job that executes a REXX script. The Rexx routine needs to determine the DSN of a specified DDNAME allocated by the JCL.

In a TSO/E session this could be done using OUTTRAP and parsing the LISTALC information. But OUTTRAP is a TSO/E function and not available when executing the script with IRXJCL.

Maybe there is an alternative? A simpler way?

Re: TSO/E Rexx and JCL to get DSN from DD Name

PostPosted: Tue Jan 26, 2016 11:20 pm
by papadilbert
Clipped from IBM, This allowed me to use the OUTTRAP() function.

You can run a REXX exec in TSO/E background. In the JCL, specify IKJEFT01 as the program name (PGM= ) on the JCL EXEC statement. On the EXEC statement, specify the member name of the exec and any arguments in the PARM field. For example, to execute an exec called TEST4 that is in data set USERID.MYREXX.EXEC, use the following JCL:
//TSOBATCH EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=4096K,PARM='TEST4'
//SYSEXEC DD DSN=USERID.MYREXX.EXEC,DISP=SHR


I had to add

//SYSTSPRT DD DUMMY

Re: TSO/E Rexx and JCL to get DSN from DD Name

PostPosted: Thu Mar 24, 2016 3:15 am
by papadilbert
I successfully used IKJEFT01 but instead of using OUTTRAP and LISTALC, I used LISTDSI.

parm= DDN1 " FILE"
rc = LISTDSI(parm)
if rc = 0 then
say "DD" DDN1 is allocated to: " sysdsname
exit


In addition to SYSTSPRT DD DUMMY I had to add SYSTSIN DD DUMMY