Customize SORT

3 posts / 0 new
Last post
Anonymous (not verified)
Customize SORT

I have a doubt in SORTING records.

Is it possible to customize sort?

Neither ascending nor descending order, Its has to be in a customized or a given order .

for Ex:

field A has values 04,05,07,09,20,25 and 30

And SORTED o/p must be in the below order for field A.






and 30 


"; ; ; ;

thanks in advance...

Anonymous (not verified)
Sorting by "custom sequence"

Append a "sort field" at the end of each input record that contains a value that when sorted will force the data into the order you want (i.e. 04 = 01, 05=02, 09=03, 20=04, 07=05 etc). Sort by this appended data and strip it off when writing the output form the sort.

Joined: 01/18/2012 - 19:57
Strange sort
The idea to add a qualifier to the sort field is a good one, and may be the only one you need. Additionally, SORT has two exits: E15 and E35 allow records to be added, deleted, or changed. E15 works in input data to the sort; E35 works on output data from the sort. COBOL has provision for E15 and E35; if I remember correctly, it's the INPUT PROCEDURE (E15) and OUTPUT PROCEDURE (E35).
Log in or register to post comments
Sponsored Listing

Click the +1 button  below to share it with your friends and colleagues


Share this if you liked it!