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
 

 

sorting on other than ascending/descending order

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

New User


Joined: 07 Feb 2007
Posts: 22
Location: hyderabad

PostPosted: Thu Aug 30, 2007 10:58 am    Post subject: sorting on other than ascending/descending order
Reply with quote

can we sort on the basis of an user defined order which is other than ascending or descending order.

for eg:

100A100
100B100
100C100

fourth position to be sorted in the order B, A, C.
so the o/p will be like

100B100
100A100
100C100
Back to top
View user's profile Send private message

shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Aug 30, 2007 11:04 am    Post subject:
Reply with quote

Code:
// EXEC PGM=SORT                                         
//SORTIN DD *                                           
100A100                                                 
100B100                                                 
100C100                                                 
/*                                                       
//SORTOUT DD SYSOUT=*                                   
//SYSOUT DD SYSOUT=*                                     
//SYSIN DD *                                             
 INREC IFTHEN=(WHEN=(4,1,CH,EQ,C'B'),OVERLAY=(81:C'1')),
       IFTHEN=(WHEN=(4,1,CH,EQ,C'A'),OVERLAY=(81:C'2')),
       IFTHEN=(WHEN=(4,1,CH,EQ,C'C'),OVERLAY=(81:C'3')) 
 SORT FIELDS=(81,1,ZD,A)                                 
 OUTREC FIELDS=(1,80)                                   
/*                                                       
//                                                       

Output:
Code:
100B100
100A100
100C100
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Aug 30, 2007 5:16 pm    Post subject:
Reply with quote

Even easier, look up the ALTSEQ Control Statement.....
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: Fri Aug 31, 2007 4:31 am    Post subject:
Reply with quote

srikar,

Here's a DFSORT job that switches the collating positions of 'A' and 'B':

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
100A100
100B100
100C100
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
   ALTSEQ CODE=(C2C1,C1C2)
   SORT FIELDS=(1,7,AQ,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 Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Adding a descending character to a file Steve Ironmonger DFSORT/ICETOOL 3 Fri Jul 15, 2016 4:57 pm


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