Skip to Content
Custom Search

Customize SORT

2 replies [Last post]
Anonymous

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.

04

05

09

20

07
25 

and 30 

 

"; ; ; ;

thanks in advance...

Sponsored Listing
Ted
Offline
Joined: 01/18/2012
Posts:
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).
Anonymous
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.

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

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 13 guests online.
Dr. Radut | forum