IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort Step Needs to be Combined in ICETOOL Step


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Souvik.Sinha

New User


Joined: 22 Apr 2005
Posts: 24
Location: New York, USA

PostPosted: Thu Apr 26, 2007 3:01 am
Reply with quote

Hi,
I am new to ICETOOL and really getting excited to explore and use this wonderful tool in our shop.

One of the jobs has the following steps -

Code:
//STEP1 EXEC PGM=SORT
//SORTIN    DD DSN=INFILE(0)
//             DISP=(SHR,KEEP,KEEP)
//SORTOUT   DD DSN=OUTFILE(+1),
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(1,1),RLSE),
//             DCB=(LRECL=1000,BLKSIZE=0,RECFM=FB)
//SYSIN     DD *
SORT FIELDS=(176,10,CH,A,258,10,CH,A)
OMIT COND=(1,1,CH,EQ,C'H',OR,1,1,CH,EQ,C'T')
SUM FIELDS=NONE
/*
//*
//STEP2  EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN1           DD DSN=OUTFILE(0),DISP=SHR
//IN2           DD DSN=OUTFILE(+1),DISP=SHR
//T1        DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
//             DISP=(MOD,PASS)                       
//OUT12     DD DUMMY                                       
//OUT1      DD DUMMY                                       
//OUT2      DD DSN=SORTOUT(+1),
//             DISP=(NEW,CATLG,DELETE),                   
//             DCB=(RECFM=FB,LRECL=1000),                 
//             SPACE=(CYL,(5,5))                           
//TOOLIN   DD *
COPY FROM(IN1) TO(T1) USING(CTL1)                     
COPY FROM(IN2) TO(T1) USING(CTL2)                     
SPLICE FROM(T1) TO(OUT12) ON(1,1000,CH) WITH(1002,1) -
USING(CTL3) KEEPNODUPS                               
/*
//CTL1CNTL  DD  *
  INREC OVERLAY=(1001:C'11')
/* 
//CTL2CNTL  DD *
  INREC OVERLAY=(1001:C'22')
//CTL3CNTL DD  *
OUTFIL FNAMES=OUT12,INCLUDE=(1001,2,CH,EQ,C'12'),BUILD=(1,1000)
OUTFIL FNAMES=OUT1,INCLUDE=(1001,2,CH,EQ,C'11'),BUILD=(1,1000)
OUTFIL FNAMES=OUT2,INCLUDE=(1001,2,CH,EQ,C'22'),BUILD=(1,1000)
/*
//*


To explain what we are doing here is -
in Step1, we are converting a 648-byte file to a 1000-byte file sorted on 2 fields (as given in the sort card) excluding the Header (H) and Trailer (T). Then in Step2, we are trying to find out the records, which are present in the current generation of OUTFILE, but not present in the previous generation of the OUTFILE.

My question is, can we simplify Step2 by removing those DUMMY DSN in OUT12 and OUT1 & include the Sort logic in Step1 in the ICETOOL control card itself? The OUT2 file has to be sorted per the Sort order as given in Step1.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 26, 2007 3:35 am
Reply with quote

I believe you can simplify your two steps to one ICETOOL step like this (but I haven't actually tested it since I don't have your input data sets). I'm assuming you want to keep OUTFILE(+1) as a separate data set; if not, the job could be simplified even more.

Code:

//S1     EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN0   DD DSN=INFILE(0)
//         DISP=(SHR,KEEP,KEEP)
//IN1   DD DSN=OUTFILE(0),DISP=SHR
//OUT   DD DSN=OUTFILE(+1),
//         DISP=(NEW,CATLG,DELETE),
//         UNIT=SYSDA,
//         SPACE=(CYL,(1,1),RLSE),
//         DCB=(LRECL=1000,BLKSIZE=0,RECFM=FB)
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
//            DISP=(MOD,PASS)
//OUT2     DD DSN=SORTOUT(+1),
//            DISP=(NEW,CATLG,DELETE),
//            DCB=(RECFM=FB,LRECL=1000),
//            SPACE=(CYL,(5,5))
//TOOLIN   DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
SELECT FROM(IN0) TO(OUT) ON(176,10,CH) ON(258,10,CH) -
   FIRST USING(CTL2)
SPLICE FROM(T1) TO(OUT2) ON(1,1000,CH) WITH(1002,1) -
  USING(CTL3) KEEPNODUPS
/*
//CTL1CNTL  DD  *
  INREC OVERLAY=(1001:C'11')
/*
//CTL2CNTL  DD *
  OMIT COND=(1,1,CH,EQ,C'H',OR,1,1,CH,EQ,C'T')
  OUTFIL FNAMES=OUT
  OUTFIL FNAMES=T1,OVERLAY=(1001:C'22')
//CTL3CNTL DD  *
  OUTFIL FNAMES=OUT2,INCLUDE=(1001,2,CH,EQ,C'22'),BUILD=(1,1000)
/*
//*
Back to top
View user's profile Send private message
Souvik.Sinha

New User


Joined: 22 Apr 2005
Posts: 24
Location: New York, USA

PostPosted: Thu Apr 26, 2007 5:52 pm
Reply with quote

Thanks Frank. It worked like a breeze! But I missed to mention one new requirement - the SORTOUT(+1) file has to be sorted in the following order as well:
(176,10,CH,A,258,10,CH,A)

Can I include that condition in the single step as well or do I need to add another step?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 26, 2007 9:19 pm
Reply with quote

Since you used ON(1,1000,CH) for SPLICE, it sorts the records that way.

If you need SORTOUT(+1) sorted on the other fields, then you'll have to do a separate sort for that after the SPLICE. The only way to avoid that would be if you can use ON(176,10,CH) ON(258,10,CH) for the SPLICE but that would compare on those fields instead of 1,1000,CH.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top