Allocate dsname in REXX from JCL



IBM's Command List programming language & Restructured Extended Executor

Allocate dsname in REXX from JCL

Postby mig123 » Tue Feb 17, 2015 3:11 am

Hi.
I insert the date selected from a DB2 table to a file name, for example AAA.BBB.DYYMMDD.
The JCL is difficult.
I wanted to do it in REXX, but I do not know how to pass the filename to the next step.
If I create a set of REXX example.
"ALLOC FILE (MVSF) DA ('' DSName" ') "
and in the JCL
// DD DSN = MVSF && MVSF, UNIT = SYSDA, SPACE = (TRK, (10:10), RLSE)
// DISP = (MOD, PASS), DCB = (RECFM = VB, LRECL = 70, DSORG = PS)
I get an error allocation set RC = 12.
In REXX read the date from the table.
mig123
 
Posts: 3
Joined: Tue Feb 17, 2015 2:54 am
Has thanked: 0 time
Been thanked: 0 time

Re: Allocate dsname in REXX from JCL

Postby Robert Sample » Tue Feb 17, 2015 4:35 am

This is not JCL and will not work, ever:
// DD DSN = MVSF && MVSF, UNIT = SYSDA, SPACE = (TRK, (10:10), RLSE)
// DISP = (MOD, PASS), DCB = (RECFM = VB, LRECL = 70, DSORG = PS)
Furthermore, depending upon what you are expecting to have happen, what you want to do may not be possible at all. Once submitted to the system, JCL cannot be changed -- PERIOD. Hence your desire to pass a data set name from one step to the next requires you to write the data set name to a file and then read that file in the next step (using dynamic allocation on the data set). If you want the data set name in your JCL, you can create a job and submit it through the internal reader to the system -- but it becomes a new job with absolutely no connection to the job that submitted it.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Allocate dsname in REXX from JCL

Postby mig123 » Tue Feb 17, 2015 2:14 pm

Robert, thank for your reply.
I saved to a temp file dsname from REXX.
How to "read that file in the next step (using dynamic allocation on the data set)" ?
mig123
 
Posts: 3
Joined: Tue Feb 17, 2015 2:54 am
Has thanked: 0 time
Been thanked: 0 time

Re: Allocate dsname in REXX from JCL

Postby Pedro » Tue Feb 17, 2015 10:35 pm

I saved to a temp file dsname from REXX.

Show us your JCL.
How to "read that file in the next step (using dynamic allocation on the data set)" ?

In the first step, use NEW,PASS. In the second step, use OLD,PASS. Specify the same temp data set name:
//SUPERC  EXEC PGM=ISRSUPC,PARM=(DELTAL,LINECMP,'','')         
//NEWDD  DD DSN=&SYSUID..OLDFILE,DISP=SHR   
//OLDDD  DD DSN=&SYSUID..NEWFILE,DISP=SHR   
//OUTDD  DD DSN=&&TEMP0,UNIT=SYSVIO,DISP=(NEW,PASS)
//*                                                 
//STEP2    EXEC  PGM=IEBGENER                       
//SYSPRINT DD SYSOUT=*                             
//SYSUT1   DD DISP=(OLD,PASS),DSN=&&TEMP0           
//SYSUT2   DD SYSOUT=H                             
//SYSIN    DD DUMMY                                   

It is not clear how you were planning on reading it: however you do it, you need to refer to the DD name. In the above example, you would need to refer to SYSUT1.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Allocate dsname in REXX from JCL

Postby mig123 » Wed Feb 18, 2015 1:48 pm

OK. In first step of my JCL REXX return dsname with date from database.
//SETDSN EXEC PGM=IKJEFT01,
// PARM='SETDSN &PFILE &DB2 &QULIF &INAME 167'
//SYSPROC DD DISP=SHR,DSN=&XLIB
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD DUMMY
//MVSF DD DSN=&&MVSF,UNIT=SYSDA,SPACE=(TRK,1),DISP=(NEW,PASS)

REXX (selected snippet of code):
/* rexx */
PARSE ARG PREF DB2SYS TABPREF FNAME RLEN
call SELECT_IEP_DATE
say ' DATEP='datep
datez='D'!!substr(datep,3,2)!!substr(datep,6,2)!!substr(datep,9,2) /* DYYMMDD */
mvsfile=pref!!'.'!!datez!!'.'!!fname
QUEUE mvsfile
"EXECIO * DISKW MVSF (FINIS"
exit

In the second step JCL, I would put &&MVSF as filename.
//RUNPROG EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//OUT DD DSN=&&MVSF,DISP=SHR
//SYSUDUMP DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(DB2A)
...
mig123
 
Posts: 3
Joined: Tue Feb 17, 2015 2:54 am
Has thanked: 0 time
Been thanked: 0 time

Re: Allocate dsname in REXX from JCL

Postby prino » Wed Feb 18, 2015 8:41 pm

You're confusing filename with contents of file. What you want will not work. You need TWO jobs, as you already have been told!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: Allocate dsname in REXX from JCL

Postby Pedro » Thu Feb 19, 2015 10:37 pm

It is not clear to me how the name of the data set will be used. Please elaborate.

Recalling Robert's suggestion:
your desire to pass a data set name from one step to the next requires
1. you to write the data set name to a file and
2. then read that file in the next step (using dynamic allocation on the data set).


Your two step example did #1 above, but did not do #2. How about this, in the second step:
//RUNPROG EXEC PGM=IKJEFT01
//SYSPROC DD DISP=SHR,DSN=&XLIB
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//OUT DD DSN=&&MVSF,DISP=(OLD,PASS)
//SYSUDUMP DD SYSOUT=*
//SYSTSIN DD *
 %GETMYDSN DD(OUT)  /*  rexx exec to read the name */
DSN SYSTEM(DB2A)
...

Where 'GETMYDSN' uses EXECIO on the OUT file to read the name of the actual data set, then uses the ALLOC command to allocate that data set for use in this step?
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post