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. 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 Compare only first records of the fil... SYNCSORT 7
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
Search our Forums:

Back to Top