Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Syncsort - Sort by maximum occuerence of item#

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Syncsort - Sort by maximum occuerence of item#
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    Post subject: Reply to: Sort by maximum occuerence of item#
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.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us