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

Combine 2 Sort steps to One ?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tugga11

New User


Joined: 19 May 2009
Posts: 10
Location: Charlotte

PostPosted: Thu Sep 10, 2009 12:56 am
Reply with quote

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
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Sep 10, 2009 1:52 am
Reply with quote

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?
Back to top
View user's profile Send private message
tugga11

New User


Joined: 19 May 2009
Posts: 10
Location: Charlotte

PostPosted: Thu Sep 10, 2009 2:36 am
Reply with quote

Thanks. I will check if duplicates can be ignored .
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Sep 11, 2009 11:15 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sat Sep 12, 2009 8:50 am
Reply with quote

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. icon_rolleyes.gif
Back to top
View user's profile Send private message
tugga11

New User


Joined: 19 May 2009
Posts: 10
Location: Charlotte

PostPosted: Tue Sep 15, 2009 12:07 am
Reply with quote

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
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 15, 2009 12:37 am
Reply with quote

tugga11,

It was a typo. Actually I meant SORTOF01. icon_sad.gif
Back to top
View user's profile Send private message
tugga11

New User


Joined: 19 May 2009
Posts: 10
Location: Charlotte

PostPosted: Tue Sep 15, 2009 7:22 pm
Reply with quote

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 ?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 15, 2009 7:56 pm
Reply with quote

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 icon_eek.gif

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.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Sep 15, 2009 8:20 pm
Reply with quote

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.
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 -> JCL & VSAM

 


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 Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top