Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Combine 2 Sort steps to One ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
tugga11

New User


Joined: 19 May 2009
Posts: 12
Location: Charlotte

PostPosted: Thu Sep 10, 2009 12:56 am    Post subject: Combine 2 Sort steps to One ?
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

Site Director


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

PostPosted: Thu Sep 10, 2009 1:52 am    Post subject:
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: 12
Location: Charlotte

PostPosted: Thu Sep 10, 2009 2:36 am    Post subject: Reply to: Combine 2 Sort steps to One ?
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: 500
Location: USA

PostPosted: Fri Sep 11, 2009 11:15 pm    Post subject: Reply to: Combine 2 Sort steps to One ?
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: 2285
Location: @my desk

PostPosted: Sat Sep 12, 2009 8:50 am    Post subject:
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: 12
Location: Charlotte

PostPosted: Tue Sep 15, 2009 12:07 am    Post subject: Reply to: Combine 2 Sort steps to One ?
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: 2285
Location: @my desk

PostPosted: Tue Sep 15, 2009 12:37 am    Post subject:
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: 12
Location: Charlotte

PostPosted: Tue Sep 15, 2009 7:22 pm    Post subject: Reply to: Combine 2 Sort steps to One ?
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: 2285
Location: @my desk

PostPosted: Tue Sep 15, 2009 7:56 pm    Post subject:
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: 500
Location: USA

PostPosted: Tue Sep 15, 2009 8:20 pm    Post subject: Re: Reply to: Combine 2 Sort steps to One ?
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us