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
 

 

Sort groups seperately based on different keys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vinodkrs

New User


Joined: 25 Mar 2008
Posts: 10
Location: india

PostPosted: Tue Mar 25, 2008 6:18 pm    Post subject: Sort groups seperately based on different keys
Reply with quote

I have a input file with a mix of records which falls into 5 major groups based on a particular field. I need to sort each group seperately based on different keys. how can i do this?

SAMPLE INPUT
B Y 100
A H 150
D G 120
B K 50
C G 120
A H 125
D Y 175
A G 125
C K 145
C Y 175


OUTPUT REQ

C G 120
C K 145
C Y 175
B K 50
B Y 100
A G 125
A H 125
A H 150
D G 120
D Y 175

The output must be grouped based on some keys. in the example its the first field. there are 4 groups and i need in the order C,B,A,D. i am using dfsort
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Mar 25, 2008 6:58 pm    Post subject:
Reply with quote

Hi Vinod,

You can use following sort card for these specific group & order

Code:
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'4')),             
        IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),OVERLAY=(81:C'1')),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(81:C'2')),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(81:C'3')) 
  SORT FIELDS=(81,1,CH,A)                                 
** REMOVE 81ST BYTE                                       
  OUTREC BUILD=(1,80)   


Frank can give you more optimum solution.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 25, 2008 9:09 pm    Post subject:
Reply with quote

Vinod,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
B Y 100
A H 150
D G 120
B K  50
C G 120
A H 125
D Y 175
A G 125
C K 145
C Y 175
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
* Switch A and C so order for sorting is C,B,A,D.
  ALTSEQ CODE=(C3C1,C1C3)
* Specify AQ for first field so ALTSEQ table is used.
  SORT FIELDS=(1,1,AQ,A,3,1,CH,A,5,3,ZD,A)
/*
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 -> 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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 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
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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