Page 1 of 2

how to get a DD name specified in JCL to Rexx program

PostPosted: Tue Aug 16, 2016 4:43 pm
by prasanth G
hi,
i am running a REXX program using a JCl .below is the part of jcl which i am using
"/STEP2 EXEC PGM=IRXJCL,PARM='MAINBATC'
//SYSEXEC DD DSN=IDF.REXX.COCOV.DAUG15.TARGO,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//FILEI DD DSN=IDF.REXX.DAUG15.NEW(TESTPGM1),DISP=SHR "

now, Dataset specified(IDF.REXX.DAUG15.NEW(TESTPGM1)) in FILEI i have to get this DD in a Rexx Program...,

how to get this we have to use PARSE or is there any some other possible ways
please help me out guys...,;)

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Tue Aug 16, 2016 7:37 pm
by willy jensen
If you can change your job to run TSO batch, then the easiest solution would be to capture the output from a Address TSO 'LISTALC ST' and parse it. The output is not very friendly, but it is doable.

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Tue Aug 16, 2016 9:31 pm
by Pedro
Simplest: I would pass it in like this:
//STEP2 EXEC PGM=IRXJCL,PARM='MAINBATC DD(FILEI) '


Also, I think MAINBATC should have a programming interface. One of the requirements should be to use a specific DD name.

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Tue Aug 16, 2016 9:37 pm
by willy jensen
actually not clear on what you want -
- the dataset info for ddname FILEI ?
- a list of datasets allocated to your job?

in the first case you should look at the LISTDSI built-in REXX function, in the 2nd case see my previous reply

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Wed Aug 17, 2016 10:09 am
by prasanth G
Pedro wrote:Simplest: I would pass it in like this:
//STEP2 EXEC PGM=IRXJCL,PARM='MAINBATC DD(FILEI) '


Also, I think MAINBATC should have a programming interface. One of the requirements should be to use a specific DD name.



hi,
Thanks for the reply,

The main objective is this MAINBATC (which is a member of IDF.REXX.COCOV.DAUG15.TARGO) have rexx code it will take a pds(IDF.REXX.DAUG15.NEW(TESTPGM1)) as input file and perform some operation and after that it will write a report like thing to a output file
I am using this JCL above(its not the full JCL i have used its a part) and IRXJCL utility for executing MAINBATC
i want this input file IDF.REXX.DAUG15.NEW(TESTPGM1) to be stored in a variable in (MAINBATC) so that i can use this variable for a display purpose

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Wed Aug 17, 2016 7:28 pm
by NicC
If you simply want to read the file then use EXECIO e.g.

"EXECIO 0 DISKR FILEI(OPEN"               /* Open file for update    */        
"EXECIO 1 DISKR FILEI(STEM youstem"        /* Priming read            */
 

The dataset is already allocated via the JCL.

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Wed Aug 17, 2016 9:45 pm
by Pedro
i want this input file IDF.REXX.DAUG15.NEW(TESTPGM1)

You will get better answers if you use more concise terms. Please use the terms DD name or data set name. In your example, the DD name is 'FILEI' and the data set name is 'IDF.REXX.DAUG15.NEW(TESTPGM1)'.

People get confused when you refer to a 'file'. Most people consider the DD name to be the file name. Some others think a file name refers to USS files.

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Wed Aug 17, 2016 9:59 pm
by Akatsukami
Your problem is not entirely clear to me, but it seems as if you want the data set name associated with a given DD name. If so, would you not be better off running under background TSO and using the LISTDSI external function?

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Thu Aug 18, 2016 12:46 pm
by willy jensen
I agree with Akatsukami. Unless you have a very compelling reason not to use TSO batch I strongly suggest that you use that in general. It makes life so much easier.

Re: how to get a DD name specified in JCL to Rexx program

PostPosted: Thu Aug 18, 2016 5:14 pm
by prino
It's easier to read tea leaves then to make sense of the gobbledygook of the TS...

Give us a clear description of what you want!