Adding DSN dynamically via rexx



IBM's Command List programming language & Restructured Extended Executor

Adding DSN dynamically via rexx

Postby Ramsee » Thu Nov 21, 2013 9:50 pm

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.
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Adding DSN dynamically via rexx

Postby Ramsee » Thu Nov 21, 2013 9:55 pm

The job will be submitted via rexx ex only
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Adding DSN dynamically via rexx

Postby Akatsukami » Thu Nov 21, 2013 10:06 pm

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?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Adding DSN dynamically via rexx

Postby Ramsee » Thu Nov 21, 2013 10:15 pm

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
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Adding DSN dynamically via rexx

Postby Akatsukami » Thu Nov 21, 2013 11:25 pm

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         
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Adding DSN dynamically via rexx

Postby dick scherrer » Fri Nov 22, 2013 2:16 am

Hello,

How many datasets will be concatenated?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Adding DSN dynamically via rexx

Postby Pedro » Fri Nov 22, 2013 6:28 am

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.
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: Adding DSN dynamically via rexx

Postby steve-myers » Fri Nov 22, 2013 8:25 am

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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Adding DSN dynamically via rexx

Postby Steve Coalbran » Sat Nov 23, 2013 9:41 pm

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.
Steve
User avatar
Steve Coalbran
 
Posts: 138
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 13 times
Been thanked: 1 time

Re: Adding DSN dynamically via rexx

Postby Ramsee » Wed Nov 27, 2013 7:47 pm

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
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post