Page 1 of 1

Reports using SORT

PostPosted: Fri Apr 23, 2010 12:32 am
by jawaharsmg
Hi,

I am writing a sort to create two reports which read different data files (all having same structure - so the sort outrec positions are same) and creates different reports . The only difference on the sort report outrec card will be the report header.

I will end up creating 2 members which are identically the same except for the header.

Was looking out for suggestion if we have any overrides to change header from sort JCL and keep reusing the same sort card.

thanks
Jawahar

Re: Reports using SORT

PostPosted: Fri Apr 23, 2010 12:52 am
by skolusu
show us a sample of the reports you are creating. You can create multiple reports in the same job with different headers

Re: Reports using SORT

PostPosted: Fri Apr 23, 2010 1:52 am
by jawaharsmg
//S001   EXEC PGM=SORT                                           
//SORTIN   DD DISP=SHR,DSN=XYZ
//SRT1OUT  DD DSN=ABC1,         
//            DISP=(,CATLG,DELETE),                                   
//            UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),                   
//            DCB=(RECFM=FBA,LRECL=45,BLKSIZE=0)                     
//SRT1CNTL DD *
SORT FIELDS=COPY                                       
INCLUDE COND=(1,3,CH,EQ,C'ID1 ') <<<<<<This condition
OUTFIL HEADER1=(1:'REPORT DT:',                         
               12:&DATE=(MD4/),                         
               45:'header title',/,     
                1:'REPORT ID: ',                       
               12:'123456',/,                         
      45:'XXXXXXXXXXX - ID1  ',2/, <<<<<<This heading
      1:'~col 1',13:'~',                         
     14:'col 2',25:'~',                           
     26:'col 3',39:'~',                         
     40:'col 4',54:'~'),
 TRAILER1=('~RECORDS WRITTEN : ',COUNT=(M10,LENGTH=8),//,
      1:'~--------------------------------------------',
     46:'---------------------------------------------',
     91:'-------------------'),                         
        LINES=250                                       
 OUTREC FIELDS=(C'~',1,08,C'~',                   
                09,08,C'~',                       
                17,05,C'~',                       
                22,80,C'~')                       
*                         
//S002   EXEC PGM=SORT                                           
//SORTIN   DD DISP=SHR,DSN=XYZ
//SRT2OUT  DD DSN=ABC2,       
//            DISP=(,CATLG,DELETE),                                   
//            UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),                   
//            DCB=(RECFM=FBA,LRECL=45,BLKSIZE=0)                     
//SRT2CNTL DD *
SORT FIELDS=COPY                                       
INCLUDE COND=(1,3,CH,EQ,C'ID2') <<<<<<This condition

OUTFIL HEADER1=(1:'REPORT DT:',                         
               12:&DATE=(MD4/),                         
               45:'header title',/,     
                1:'REPORT ID: ',                       
               12:'123456',/,                         
      45:'XXXXXXXXXXX - ID2  ',2/, <<<<<<This heading
      1:'~col 1',13:'~',                         
     14:'col 2',25:'~',                           
     26:'col 3',39:'~',                         
     40:'col 4',54:'~'),
 TRAILER1=('~RECORDS WRITTEN : ',COUNT=(M10,LENGTH=8),//,
      1:'~--------------------------------------------',
     46:'---------------------------------------------',
     91:'-------------------'),                         
        LINES=250                                       
 OUTREC FIELDS=(C'~',1,08,C'~',                   
                09,08,C'~',                       
                17,05,C'~',                       
                22,80,C'~')                                               
//*

Re: Reports using SORT

PostPosted: Fri Apr 23, 2010 4:12 am
by skolusu
jawahar,'

The following 1 step DFSORT jcl will create the 2 reports. You really don't need the DCB properties . Sort will automatically calculate it. Moreover you have coded them wrong. you are creating a 107 byte report , you had 45 as lrecl.

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DISP=SHR,DSN=XYZ
//SRT1OUT  DD DSN=SRT1.REPORT,         
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                       
//            UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)
//*     
//SRT2OUT  DD DSN=SRT2.REPORT,         
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                       
//            UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)
//*     
//SYSIN    DD *                                                       
  INCLUDE COND=(1,3,SS,EQ,C'ID1,ID2')                                 
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(C'~',1,8,C'~',9,8,C'~',17,5,C'~',22,80,C'~')         
                                                                       
  OUTFIL FNAMES=SRT1OUT,LINES=250,INCLUDE=(2,3,CH,EQ,C'ID1'),         
  HEADER1=(1:'REPORT DT:',12:&DATE=(MD4/),45:'HEADER TITLE',/,         
           1:'REPORT ID: ',12:'123456',/,45:'XXXXXXXXXXX - ID1  ',2/, 
           1:'~COL 1',13:'~',14:'COL 2',25:'~',                       
           26:'COL 3',39:'~',40:'COL 4',54:'~'),                       
  TRAILER1=('~RECORDS WRITTEN : ',COUNT=(M10,LENGTH=8),//,             
            1:'~',105C'-')                                             
                                                                       
  OUTFIL FNAMES=SRT2OUT,LINES=250,INCLUDE=(2,3,CH,EQ,C'ID2'),         
  HEADER1=(1:'REPORT DT:',12:&DATE=(MD4/),45:'HEADER TITLE',/,         
           1:'REPORT ID: ',12:'123456',/,45:'XXXXXXXXXXX - ID2  ',2/, 
           1:'~COL 1',13:'~',14:'COL 2',25:'~',                       
           26:'COL 3',39:'~',40:'COL 4',54:'~'),                       
  TRAILER1=('~RECORDS WRITTEN : ',COUNT=(M10,LENGTH=8),//,             
            1:'~',105C'-')                                             
//*