Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
tugga11

New User

Joined: 19 May 2009
Posts: 12
Location: Charlotte

 Posted: Thu Sep 10, 2009 12:56 am    Post subject: Combine 2 Sort steps to One ? Hi I have 2 sort steps in a Job Step 1- File A with Lrecl 1500 and huge nnumber of records is Sorted using and it produces File B (unique records) and File C (Duplicate records in Xsum) Out of 42 milloin records only 1 million is duplicates. SORT FIELDS=(1,18,CH,A) SUM FIELDS=NONE,XSUM Step 2 - Sorts the File B (unique records) produced in step 1 by SORT FIELDS=(22,4,CH,A,26,21,CH,A,98,3,CH,A) and produces File D . Each of these steps run for 2.5 hours . My Question is , if we ombine these 2 sort steps into one (Doing the second sort along with Xsum like one given below) , will it provide savings in elapsed time ? SORT FIELDS=(1,18,CH,A,22,4,CH,A,26,21,CH,A,98,3,CH,A) SUM FIELDS=NONE,XSUM

dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Thu Sep 10, 2009 1:52 am    Post subject: Hello, The first step eliminates duplicates on one field - positions 1-18. The combined control statement would not eliminate these same duplicates. . . The number of "unique" records would increase (most likely) because of the additional fields. How many processes use the sorted file of only unique records? If only 1 or a few, could duplicates simply be ignored then?
tugga11

New User

Joined: 19 May 2009
Posts: 12
Location: Charlotte

 Posted: Thu Sep 10, 2009 2:36 am    Post subject: Reply to: Combine 2 Sort steps to One ? Thanks. I will check if duplicates can be ignored .
Alissa Margulies

SYNCSORT Support

Joined: 25 Jul 2007
Posts: 500
Location: USA

Posted: Fri Sep 11, 2009 11:15 pm    Post subject: Reply to: Combine 2 Sort steps to One ?

Tugga11,

Try the following untested sort step:
 Code: //SORT1  EXEC PGM=SORT                                        //SORTIN   DD DSN=INPUT.FILE  (FB/1500)                      //SORTOF01 DD DSN=UNIQUE.RECORDS  (FB/1500)                  //SORTOF02 DD DSN=DUPLICATE.RECORDS  (FB/1500)                //SYSOUT   DD SYSOUT=*                                        //SYSIN    DD *                                                 SORT FIELDS=(1,18,CH,A,22,4,CH,A,26,21,CH,A,98,3,CH,A)       OUTREC OVERLAY=(1501:SEQNUM,8,ZD,RESTART=(1,18))             OUTFIL FILES=01,INCLUDE=(1501,8,ZD,EQ,1),OUTREC=(1,1500)     OUTFIL FILES=02,SAVE,OUTREC=(1,1500)                      /*

Let me know if you do not get the desired output.
Arun Raj

Moderator

Joined: 17 Oct 2006
Posts: 2352
Location: @my desk

 Posted: Sat Sep 12, 2009 8:50 am    Post subject: Alissa, I doubt if the above card will make sure the order of SORTOF02 records to be SORT FIELDS=(22,4,CH,A,26,21,CH,A,98,3,CH,A). Let me know if I missed something.
tugga11

New User

Joined: 19 May 2009
Posts: 12
Location: Charlotte

 Posted: Tue Sep 15, 2009 12:07 am    Post subject: Reply to: Combine 2 Sort steps to One ? Arun SORTOF2 contains only duplicates and need not be sorted . I verified that duplicates are required for Business. I am going to try the new Sort card and keep everyone posted. Thanks
Arun Raj

Moderator

Joined: 17 Oct 2006
Posts: 2352
Location: @my desk

 Posted: Tue Sep 15, 2009 12:37 am    Post subject: tugga11, It was a typo. Actually I meant SORTOF01.
tugga11

New User

Joined: 19 May 2009
Posts: 12
Location: Charlotte

 Posted: Tue Sep 15, 2009 7:22 pm    Post subject: Reply to: Combine 2 Sort steps to One ? Yes. I tested this . My uique records are sorted in (1,18,CH,A,22,4,CH,A,26,21,CH,A,98,3,CH,A) whereas it should be in FIELDS=(22,4,CH,A,26,21,CH,A,98,3,CH,A ) order . Also duplicates should be in 1, 18 order but it is same order as above. I am changing this sort card to //SYSIN DD * SORT FIELDS=(22,4,CH,A,26,21,CH,A,98,3,CH,A) OUTREC OVERLAY=(1501:SEQNUM,8,ZD,RESTART=(1,18)) OUTFIL FILES=01,INCLUDE=(1501,8,ZD,EQ,1),OUTREC=(1,1500) OUTFIL FILES=02,SAVE,OUTREC=(1,1500) So that unique records are sorted in correct order. But is it possible to give a sort condition in OUTFIL FILES=02 so that duplicates are in (1, 18 , CH, A ) order ?
Arun Raj

Moderator

Joined: 17 Oct 2006
Posts: 2352
Location: @my desk

Posted: Tue Sep 15, 2009 7:56 pm    Post subject:

 Quote: So that unique records are sorted in correct order
Yes. It'll be sorted in correct order. But the records may not be unique now

OUTREC OVERLAY=(1501:SEQNUM,8,ZD,RESTART=(1,18)). The RESTART parameter here would work combining with the SORT FIELDS=(1,18,...) so that INCLUDE given in your OUTFIL FILES=01 extracts only the first record out of each key occurring at pos 1-18. Now that you have removed pos 1-18 from the sort fields, it may not be extracting 'unique' records.
Alissa Margulies

SYNCSORT Support

Joined: 25 Jul 2007
Posts: 500
Location: USA

Posted: Tue Sep 15, 2009 8:20 pm    Post subject: Re: Reply to: Combine 2 Sort steps to One ?

 tugga11 wrote: My uique records are sorted in (1,18,CH,A,22,4,CH,A,26,21,CH,A,98,3,CH,A) whereas it should be in FIELDS=(22,4,CH,A,26,21,CH,A,98,3,CH,A ) order .

Sorry, I read through the requirements too fast and missed the detail regarding the different sort order for the second output file. I was focusing on your question regarding savings in elapsed time.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us