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

Syncsort - Sort by maximum occuerence of item#


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
sudip_mitra

New User


Joined: 05 Apr 2006
Posts: 5
Location: India

PostPosted: Tue Jan 11, 2011 10:15 pm
Reply with quote

Hi,

I have a requirement, input file need to be sorted as maximum number of occurrences of Item# will come first then next maximum occurrences.

File input looks like:

1111ABC
1111ABC
1111ABC
0111DDD
0111DDD
0111DDD
0111DDD
0111DDD
0011XXX
0011XXX

Sorted file look like:
0111DDD
0111DDD
0111DDD
0111DDD
0111DDD
1111ABC
1111ABC
1111ABC
0011XXX
0011XXX

Can anyone suggest how can I achieve this using sort.

Thanks,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jan 11, 2011 11:38 pm
Reply with quote

sudip_mitra,

Use the following DFSORT JCL which will give you the desired results. I assumed your input file is FB Recfm and LRECL of 80.

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//INA      DD DSN=your input file,DISP=SHR
//INB      DD DSN=same input file again,DISP=SHR
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  JOINKEYS F1=INA,FIELDS=(1,7,A)     
  JOINKEYS F2=INB,FIELDS=(1,7,A)     
  JOIN UNPAIRED                       
  REFORMAT FIELDS=(F1:1,80,F2:81,8)   
  SORT FIELDS=(81,8,CH,D),EQUALS
  OUTREC BUILD=(1,80)       
//JNF2CNTL DD *                       
  INREC OVERLAY=(81:7C'0',C'1')       
  SUM FIELDS=(81,8,ZD)               
//*
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Alternative of JoinKeys in SORT DFSORT/ICETOOL 2
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Simplify SORT CARD to combine INREC a... DFSORT/ICETOOL 6
No new posts Sort card to generate the DSN DFSORT/ICETOOL 17
Search our Forums:


Back to Top