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 card for User Defined order of values

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

New User


Joined: 09 May 2005
Posts: 30
Location: Hyderabad

PostPosted: Fri Nov 30, 2012 4:07 pm    Post subject: Sort card for User Defined order of values
Reply with quote

Hi All,

I have a following sort card to arrannge the data in an ascending order. The below SORT card will fulfil the purpose. Read further to know the actual requirment out of this SORT card.

SORT FIELDS=(1,8,CH,A, <<== DATE filed
9,20,CH,A, <<== Read the Requirement below
29,20,CH,A, <<== Column 3
49,10,CH,A, <<== Column 4
59,10,CH,A) <<== Column 5

Requirement:
First 8 characters is DATE, Let it as it is in the Ascending order.
Second filed is Location, Out of different possible values for the Location, I want to define my own order such as IJK, ABC, PQR and DEF etc. These 4 locations should be in the top order (After DATE) and if still any other locations occur in the file, then they should follow the first 4 user defined locations in the ascending order. Rest of the fileds (Column 3, Column 4, Column 5) will be in the same ascending order as shown in the above sort card.
Back to top
View user's profile Send private message

rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Fri Nov 30, 2012 4:28 pm    Post subject: Reply to: Sort card for User Defined order of values
Reply with quote

hi Venkata,

Okay, this would work much faster, if you give some sample input records and the sample output records with the record lengths, key field postions and the rules for sorting.
Back to top
View user's profile Send private message
venkata.ravi

New User


Joined: 09 May 2005
Posts: 30
Location: Hyderabad

PostPosted: Fri Nov 30, 2012 5:09 pm    Post subject:
Reply with quote

Rakesha.hg,

As suggested, Here are the additiaonal details.

Note: **** represents column 3, column 4 and Column 5. As they don't need any changes, I didn't include them in the example. Also lenth of the file would be 176 bytes

Input file looks like
Code:
20122811ABC                 **********
20122811ABC                 **********
20122911ABC                 **********
20122811PQR                 **********
20122811ABC                 **********
20122911ABC                 **********
20122811DEF                 **********
20122911PQR                 **********
20122911IJK                 **********


Output for the above SORT card
Code:
20122811ABC                 **********
20122811ABC                 **********
20122811ABC                 **********
20122811DEF                 **********
20122811PQR                 **********
20122911ABC                 **********
20122911ABC                 **********
20122911IJK                 **********
20122911PQR                 **********


Desired Output
Code:
20122811ABC                 **********
20122811ABC                 **********
20122811ABC                 **********
20122811PQR                 **********
20122811DEF                 **********
20122911IJK                 **********
20122911ABC                 **********
20122911ABC                 **********
20122911PQR                 **********
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Fri Nov 30, 2012 6:11 pm    Post subject: Reply to: Sort card for User Defined order of values
Reply with quote

the code snippet

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=H
 000003 //*
 000004 //S1      EXEC PGM=SORT
 000005 //SYSPRINT  DD SYSOUT=*
 000006 //SYSOUT    DD SYSOUT=* IJK, ABC, PQR AND DEF
 000007 //SORTIN    DD *
 000008 20122811AAA                 **********
 000009 20122811AAB                 **********
 000010 20122811IKJ                 **********
 000011 20122811PQR                 **********
 000012 20122811DEF                 **********
 000013 20122811ABC                 **********
 000014 20122711AAA                 **********
 000015 20122711AAB                 **********
 000016 20122711IKJ                 **********
 000017 20122711PQR                 **********
 000018 20122711DEF                 **********
 000019 //SORTOUT   DD SYSOUT=*
 000020 //SYSIN     DD *
 000021   INREC  IFTHEN=(WHEN=(9,3,CH,EQ,C'IKJ'),OVERLAY=(51:C'00001')),
 000022          IFTHEN=(WHEN=(9,3,CH,EQ,C'ABC'),OVERLAY=(51:C'00002')),
 000023          IFTHEN=(WHEN=(9,3,CH,EQ,C'PQR'),OVERLAY=(51:C'00003')),
 000024          IFTHEN=(WHEN=(9,3,CH,EQ,C'DEF'),OVERLAY=(51:C'00004')),
 000025          IFTHEN=(WHEN=NONE,OVERLAY=(51:C'99999'))
 000026   SORT   FIELDS=(1,4,CH,A,7,2,CH,A,5,2,CH,A,51,5,CH,A,9,3,CH,A)
 000027 //*
 ****** **************************** Bottom of Data ****************************


the result
Code:
********************************* TOP OF DATA **********************************
20122711IKJ                 **********            00001
20122711PQR                 **********            00003
20122711DEF                 **********            00004
20122711AAA                 **********            99999
20122711AAB                 **********            99999
20122811IKJ                 **********            00001
20122811ABC                 **********            00002
20122811PQR                 **********            00003
20122811DEF                 **********            00004
20122811AAA                 **********            99999
20122811AAB                 **********            99999
******************************** BOTTOM OF DATA ********************************


change the offsets accordingly ...

the overlay should be 1 byte after the data ...
in Your case 177
and the sort card should be modified accordingly
remember to add a build to writ just the first 176 bytes
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 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