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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 0 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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