Dynamicaly outdataset creation



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Dynamicaly outdataset creation

Postby shyamsaravan » Thu Aug 19, 2010 6:32 pm

Hi;

Input file is
BEGIN       CURRENT               
SAMPLEFILCURRENT2000-08-06
SAMPLEFILCURRENT2000-08-06
SAMPLEFILCURRENT2000-08-06
END
BEGIN       SUPPORT               
SAMPLEFILSUPPORT2000-08-06
SAMPLEFILSUPPORT2000-08-06
END
BEGIN       MANAGER               
SAMPLEFILMANAGER2000-08-06
SAMPLEFILMANAGER2000-08-06
SAMPLEFILMANAGER2000-08-06
END
BEGIN       PRODUCT               
SAMPLEFILPRODUCT2000-08-06
SAMPLEFILPRODUCT2000-08-06
SAMPLEFILPRODUCT2000-08-06
SAMPLEFILPRODUCT2000-08-06
END


My Jcl
//STEP1    EXEC  PGM=SORT                                     
//SYSOUT   DD  SYSOUT=*                                       
//SORTIN   DD DSN=FB=256 input GDG,                 
//             DISP=SHR                                       
//OUT1     DD DSN=EOUT.V001,                         
//            DISP=(,CATLG,DELETE),                       
//            UNIT=SYSDA,SPACE=(TRK,(15,15),RLSE)
//OUT2    DD DSN=EOUT.V002,                         
//            DISP=(,CATLG,DELETE),                       
//            UNIT=SYSDA,SPACE=(TRK,(15,15),RLSE)
//SYSIN    DD    *                                             
     OPTION COPY                                               
     INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),     
                                   PUSH=(257:ID=1))             
       OUTFIL FNAMES=OUT1,INCLUDE=(257,1,ZD,EQ,1),BUILD=(1,256)
       OUTFIL FNAMES=OUT2,INCLUDE=(257,1,ZD,EQ,2),BUILD=(1,256)
/*                                                                                                                         


The produced output
First outdataset is
BEGIN       CURRENT               
SAMPLEFILCURRENT2000-08-06
SAMPLEFILCURRENT2000-08-06
SAMPLEFILCURRENT2000-08-06
END

second outdataset
BEGIN       SUPPORT               
SAMPLEFILSUPPORT2000-08-06
SAMPLEFILSUPPORT2000-08-06
END


The input file has set of records with header and trailer,.Header is BEGIN,Trailer is END
Every time the set of records may vary.So we cant give correct number of the OUTFIL parameter.

Is it possible to create a outdataset and OUTFIL dynamically according to the records split

For this example,the above input file has 4 set of records,so i need 4 outdatasets with the particular set of records.

but the SORT card has only 2 OUTFIL and Outdatasets.
How to generate the outdataset dynamically according to the set of records.

Thanks;
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamicaly outdataset creation

Postby skolusu » Thu Aug 19, 2010 10:08 pm

shyamsaravan,

You can generate the CONTROL Cards and output File allocation and submit it to the INTRDR as a new job. or you can write a program to dynamically allocate the output files
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Dynamicaly outdataset creation

Postby shyamsaravan » Fri Aug 20, 2010 7:55 pm

Thanks,Can you post just bit of code which will be very helpful for me
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamicaly outdataset creation

Postby MrSpock » Sat Aug 21, 2010 5:29 pm

To start, I'd change your INREC code just a little:

  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),PUSH=(257:ID=3,260:SEQ=3))


Then, you could build the new JCL for the next job

  OUTFIL FNAMES=JCLOUT,REMOVECC,HEADER1=('//JOBNAME JOB (......)',/,'// .... ',/,
     '//STEP0001 EXEC PGM=SORT',/,
     '//SORTIN   DD DSN=FB=256 input GDG,DISP=SHR',/,
     '//SYSOUT DD SYSOUT=*','//SYSIN DD *',80:X),
    BUILD=(C'//OUT',257,3,C' DD DSN=EOUT.V',257,3,C',DISP=(,CATLG,DELETE),',/,
      C'// UNIT=SYSDA,SPACE=(TRK,(15,15),RLSE)',80:X),INCLUDE=(260,3,ZD,001)


and the subsequent SORT control cards

  OUTFIL FNAMES=SORTCNTL,REMOVECC,HEADER1=('  OPTION COPY',80:X),
    BUILD=(C'  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'''BEGIN'''),PUSH=(257:ID=3))',/,
               C'    OUTFIL FNAMES=OUT',257,3,C' INCLUDE=(257,3,ZD,EQ,',257,3,C'),BUILD=(1,256)'),INCLUDE=(260,3,ZD,001)
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Dynamicaly outdataset creation

Postby shyamsaravan » Tue Aug 24, 2010 1:35 pm

Hi;

Thanks,I faced some of the errors..Please have a look on the below code.,Is it a right way the flow of coding ?

//STEP001  EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=input 256FB file,DISP=SHR               
//SORTOUT  DD SYSOUT=(*,INTRDR)                               
//JCLOUT   DD DSN=jclEOUT,                         
//            DISP=(MOD,CATLG,DELETE),                         
//            UNIT=SYSDA,SPACE=(TRK,(15,15),RLSE)
//*                                                           
//SYSIN    DD *                                               
 OPTION COPY                                                       
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),             
                          PUSH=(257:ID=3,260:SEQ=3))                             
  OUTFIL FNAMES=JCLOUT,                                             
   REMOVECC,HEADER1=('//jobnameP JOB t00000T,''',C'user''',C',',/, 
          '//             CLASS=T,MSGCLASS=Z,NOTIFY=&SYSUID',/,     
          '//*',/,                                                 
          '//STEP002  EXEC  PGM=SORT',/,                           
          '//SYSOUT   DD SYSOUT=*',/,                               
          '//SORTIN   DD DSN=input 256FB file,DISP=SHR',/,     
         '//SYSOUT DD SYSOUT=*','//SYSIN DD *',80:X),               
     BUILD=(C'//OUT',257,3,C' DD DSN=TEST.EOUT.V',257,3,C',',/,   
     C'//        DISP=(,CATLG,DELETE),',/,                         
     C'//       UNIT=SYSDA,',/,                                     
     C'// SPACE=(TRK,(15,15),RLSE)',80:X),INCLUDE=(260,3,ZD,001)                                     
OUTFIL FNAMES=SORTCNTL,REMOVECC,HEADER1=('  OPTION COPY',80:X),     
    BUILD=(C'  INREC IFTHEN=(WHEN=GROUP,',/,                       
               BEGIN=(1,5,CH,EQ,C'''BEGIN'''),PUSH=(257:ID=3))',/,
               C'    OUTFIL FNAMES=OUT',257,3,C',/,                 
                INCLUDE=(257,3,ZD,EQ,',257,3,C'),',/,       
               BUILD=(1,256)'),INCLUDE=(260,3,ZD,001)     
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamicaly outdataset creation

Postby skolusu » Tue Aug 24, 2010 9:58 pm

shyamsaravan,

Use the following DFSORT JCL which will give you the desired results. Verify the JCL generated in step0200. and if it looks ok then change the step0200 SORTOUT statement to the following
//SORTOUT  DD SYSOUT=(*,INTRDR)   




//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=Your 256 byte FB input file,DISP=SHR
//CARDS    DD DSN=&&CARDS,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//DDNAME   DD DSN=&&DDNAME,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),PUSH=(257:ID=5)) 
  OUTFIL FNAMES=CARDS,REMOVECC,NODETAIL,BUILD=(80X),                   
  HEADER1=(3:'OPTION COPY',/,                                           
           3:'INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C''',           
             'BEGIN''','),PUSH=(257:ID=5))',80:X),                     
  SECTIONS=(257,5,                                                     
  TRAILER3=(3:'OUTFIL FNAMES=OUT',257,5,                               
              ',INCLUDE=(257,5,ZD,EQ,',257,5,                           
              '),BUILD=(1,256)',80:X)),                                 
  TRAILER1=(1:'//*',80:X)                                               
                                                                       
  OUTFIL FNAMES=DDNAME,REMOVECC,NODETAIL,BUILD=(80X),                   
  SECTIONS=(257,5,                                                     
  TRAILER3=('//OUT',257,5,X,'DD DSN=YOUR.FILE.OUT',257,5,',',/,           
            '//',12X,'DISP=(NEW,CATLG,DELETE),',/,                     
            '//',12X,'UNIT=SYSDA,',/,                                   
            '//',12X,'SPACE=(CYL,(X,Y),RLSE)',/,                       
            '//*',80:X))                                               
//*                                 
//STEP0200 EXEC  PGM=SORT                 
//SYSOUT   DD SYSOUT=*                     
//SYSIN    DD *                           
   SORT FIELDS=COPY                       
/*                                         
//SORTOUT  DD SYSOUT=*                     
//SORTIN   DD DATA,DLM=$$                 
//TIDXXXXA JOB 'COPY',                     
//             CLASS=A,                   
//             MSGCLASS=Y,                 
//             MSGLEVEL=(1,1),             
//             NOTIFY=TID                 
//*                                       
//STEP0100 EXEC  PGM=SORT                 
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD DSN=Your 256 byte FB input file,DISP=SHR
//SYSIN    DD *                               
$$                                             
//         DD DSN=&&CARDS,DISP=(OLD,PASS)     
//         DD DSN=&&DDNAME,DISP=(OLD,PASS)     
//*


The jcl generated will be as follows

//TIDXXXXA JOB 'COPY',                                                 
//             CLASS=A,                                                 
//             MSGCLASS=Y,                                             
//             MSGLEVEL=(1,1),                                         
//             NOTIFY=TID                                               
//*                                                                     
//STEP0100 EXEC  PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=YOUR 256 BYTE FB INPUT FILE,DISP=SHR                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),PUSH=(257:ID=5)) 
  OUTFIL FNAMES=OUT00001,INCLUDE=(257,5,ZD,EQ,00001),BUILD=(1,256)     
  OUTFIL FNAMES=OUT00002,INCLUDE=(257,5,ZD,EQ,00002),BUILD=(1,256)     
  OUTFIL FNAMES=OUT00003,INCLUDE=(257,5,ZD,EQ,00003),BUILD=(1,256)     
  OUTFIL FNAMES=OUT00004,INCLUDE=(257,5,ZD,EQ,00004),BUILD=(1,256)     
//*                                                                     
//OUT00001 DD DSN=YOUR.FILE.OUT00001,                                   
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(X,Y),RLSE)                                   
//*                                                                     
//OUT00002 DD DSN=YOUR.FILE.OUT00002,                                   
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(X,Y),RLSE)                                   
//*                                                                     
//OUT00003 DD DSN=YOUR.FILE.OUT00003,                                   
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(X,Y),RLSE)                                   
//*                                                                     
//OUT00004 DD DSN=YOUR.FILE.OUT00004,                                   
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(X,Y),RLSE)                                   
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Dynamicaly outdataset creation

Postby shyamsaravan » Wed Aug 25, 2010 8:00 pm

Thank you verymuch Kolusu..If possible,give some explanation about the coding..it will really helpful for all :D
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamicaly outdataset creation

Postby skolusu » Wed Aug 25, 2010 11:08 pm

shyamsaravan,

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/servers/storage/supp ... tmpub.html
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post