Page 1 of 2

Adding DSN dynamically via rexx

PostPosted: Thu Nov 21, 2013 9:50 pm
by Ramsee
Hi all,

I have a typical requirement that I need to add a DD statement dynamically based on number of datasets for concatenation into one dsn.

List of dsn will be know after executing the step1 only and Step 3 will take concatenated dsn for further process.

Please suggest me how to build the step2 did statement dynamically.

Kindly let me know if you have any further information.

Re: Adding DSN dynamically via rexx

PostPosted: Thu Nov 21, 2013 9:55 pm
by Ramsee
The job will be submitted via rexx ex only

Re: Adding DSN dynamically via rexx

PostPosted: Thu Nov 21, 2013 10:06 pm
by Akatsukami
This seems a very trivial task; read the list of DSNs, add them to a ISPF table, and tailor a skeleton. Is there some complexity that you are not mentioning?

Re: Adding DSN dynamically via rexx

PostPosted: Thu Nov 21, 2013 10:15 pm
by Ramsee
To be frank I unzippeed list of dsn via EZT and written the list of dsn in a file now I need to concatenate list of all the dsn names in the file into a master concatenated file and need to process further.
I like to know how to add dd names dynamically by reading via fine and transferring them into a skeleton JCL because the count of the file may vary for every run. Please guide me how to proceed on this.

Thanks,
Ramsee

Re: Adding DSN dynamically via rexx

PostPosted: Thu Nov 21, 2013 11:25 pm
by Akatsukami
Let's see if this meets your needs:

The FOO110 exec:
/* Rexx */                                                       
/* Written Heisei 25.11.21 by Akatsukami-sama */                 
  trace o                                                         
  seq = 0                                                         
  sig = x2c("E69989A3A3859540C88589A2858940F2F54BF1F14BF2F140")   
  sig = sig || x2c("82A840C19281A3A2A49281948960A2819481")       
  uid = userid()                                                 
  address ispexec "TBCREATE TADSN NAMES (DSN SEQ) NOWRITE REPLACE"
  "EXECIO 1 DISKR TULIN"                                         
                                                                 
  do while (rc=0)                                                 
    seq = seq + 1                                                 
    pull dsn .                                                   
    address ispexec "TBADD TADSN"                                 
    "EXECIO 1 DISKR TULIN"                                       
  end                                                             
                                                                 
  address ispexec "FTOPEN  TEMP"                                 
  address ispexec "FTINCL  SAG"                                   
  address ispexec "FTCLOSE"                                       
  address ispexec "VGET ZTEMPF"                                   
  "SUBMIT '"ztempf"'"                                             


The SAG skeleton:
//&UID.S JOB  ,SYNCSORT,CLASS=S,MSGCLASS=1,                           
//         REGION=0M,SCHENV=JOB@ANY                                   
//*                                                                   
//********************************************************************
//STEP21   EXEC PGM=SORT                                             
//SYSOUT   DD   SYSOUT=*                                             
)DOT TADSN                                                           
)IF &SEQ = 1 THEN )DO                                                 
//SORTIN   DD   DSN=&DSN,DISP=SHR                                     
)ENDDO                                                               
)ELSE )DO                                                             
//         DD   DSN=&DSN,DISP=SHR                                     
)ENDDO                                                               
)ENDDOT                                                               
//SORTOUT  DD   DSN=&&CONSOL,DISP=(NEW,PASS)                         
//SYSIN    DD   *                                                     
  SORT FIELDS=COPY                                                   
/*                                                                   
//*                                                                   
//STEP22   EXEC PGM=P2                                               
//* this step uses the consolidated data set created in STEP21       


When this job
//FOOISPF JOB ,'Generic ISPF',CLASS=S,MSGCLASS=1,SCHENV=JOB@ANY,     
//         REGION=0M                                                 
//*                                                                   
//STEP11   EXEC  PGM=IEBGENER                                         
//SYSPRINT DD    SYSOUT=*                                             
//SYSUT1   DD    *                                                   
FOO.BAR1                                                             
FOO.BAR2                                                             
FOO.BAR3                                                             
//SYSUT2   DD    DSN=FOO.FOO,DISP=OLD                                 
//*                                                                   
//STEP12   EXEC  ISPFB,                                               
//             DYNAMNBR=25                                           
//ISPPROF  DD DSN=&PROF,DISP=(,DELETE),UNIT=TEMPDISK,                 
//            SPACE=(CYL,(2,1,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8880)
//SYSPRINT DD SYSOUT=*                                               
//SYSTSPRT DD SYSOUT=*,                                               
//            DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0,DSORG=PS)           
//ISPFILE  DD DSN=FOO.TOOLS.CNTL,DISP=SHR                             
//SYSPROC  DD DSN=FOO.WORK.CLIST,DISP=SHR                             
//ISPLLIB  DD DSN=FOO.WORK.LOAD,DISP=SHR                             
//ISPSLIB  DD DSN=FOO.WORK.SKELS,DISP=SHR                             
//ISPTLIB  DD DSN=FOO.ISP.ISPTLIB,DISP=SHR                           
//TULIN    DD DSN=FOO.FOO,DISP=SHR                                   
//SYSTSIN  DD *                                                       
  ISPSTART CMD(%FOO110)                                               

is run, the following JCL is fabricated and submitted.
//FOOS JOB  ,SYNCSORT,CLASS=S,MSGCLASS=1,
//         REGION=0M,SCHENV=JOB@ANY                                     
//*                                                                     
//******************************************************************** 
//STEP21   EXEC PGM=SORT                                               
//SYSOUT   DD   SYSOUT=*                                               
//SORTIN   DD   DSN=FOO.BAR1,DISP=SHR                                 
//         DD   DSN=FOO.BAR2,DISP=SHR                                 
//         DD   DSN=FOO.BAR3,DISP=SHR                                 
//SORTOUT  DD   DSN=&CONSOL,DISP=(NEW,PASS)                             
//SYSIN    DD   *                         
    SORT FIELDS=COPY                             
/*                                                                     
//*                                                                     
//STEP22   EXEC PGM=P2                                                 
//* this step uses the consolidated data set created in STEP21         

Re: Adding DSN dynamically via rexx

PostPosted: Fri Nov 22, 2013 2:16 am
by dick scherrer
Hello,

How many datasets will be concatenated?

Re: Adding DSN dynamically via rexx

PostPosted: Fri Nov 22, 2013 6:28 am
by Pedro
I think step2 in your job should be to invoke a rexx program, and with the JCL having DD statements for both the rexx program and for IEBGENER:
//STEP2    EXEC PGM=IKJEFT01,DYNAMNBR=45 
//SYSUT2   DD DISP=SHR,DSN=MASTER.DSN
//SYSIN    DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSPROC   DD DISP=SHR,DSN=MY.EXEC
//SYSTSPRT  DD SYSOUT=H               
//SYSTSIN   DD *                         
 %MYREXX                                 
/*                                       


and the rexx which does:
1. reads input file.
2. parses dataset names
3. issues TSO ALLOC command:
   ALLOC F(SYSUT1) DSN(dsn1,dsn2,dsn3,...)
4. Address LINKMVS "IEBGENER"

IEBGENER will copy the many individual datasets to the master dataset. I think there are limitations on the number of datasets in the concatenation and the length of the command string. It might be a problem if there are many datasets.

Re: Adding DSN dynamically via rexx

PostPosted: Fri Nov 22, 2013 8:25 am
by steve-myers
Pedro, I've entered some very long commands and never ran into an issue with command length. The theoretical limit is 32767, though the practical limit may be less. This link may answer your question. The ALLOCATE command may impose a limit on the number of data set names you can specify, and there are, of course, other limits imposed by the operating system. Notice the discussion about PDL size, though a list of data set names will not cause this limit to be exceeded; the first data set name uses 28 bytes of PDL space; the remaining data set names allocate storage that is not, technically, part of the PDL.

Re: Adding DSN dynamically via rexx

PostPosted: Sat Nov 23, 2013 9:41 pm
by Steve Coalbran
Have you investigated the possibility of using CALL BPXWDYN "CONCAT... " ?
Look it up on Google.
I have not used BPXWDYN for this purpose yet, but I am increasingly using it for allocating temporary datasets to VIEW etc. later.

Re: Adding DSN dynamically via rexx

PostPosted: Wed Nov 27, 2013 7:47 pm
by Ramsee
Hi All,

Thanks a ton for the timely help reply!!
I have used the solution provided by Mr.Akatuskami that DYNAMIC DSN was given to the SORT input and output was concatenated as suggested by him.

Once again thanks a ton to everyone for your guidence.

Regards,
Ramsee