Joined: 27 Mar 2009 Posts: 13 Location: London, UK
Hi everyone,
I am stuck as to how I can accomplish the following, does anyone have any ideas please?...
I would like to sort this file by an identifying number, then date, and then by a custom (arbitrary) order of characters. The input file will look like...
(Number is char 1-6, Date is char 8-10, Custom is char 19-1)
which when sorted should in this case reverse the order putting the lowest number first, then by date and the last column instead of being alphabetical I would like to have ordered by 'C' then 'S' then 'P'.
Joined: 27 Mar 2009 Posts: 13 Location: London, UK
Thankyou for the very quick reply gcicchet, I'm slightly embarassed I didn't think of that for the date. Though it still leaves me with the final character problem as the order I need is not alphabetical (C then S then P). I'm thinking of replacing the characters preceding space with numbers and sorting by that, which may be the simplest solution.
Something along the lines of...
Code:
INREC FINDREP=(INOUT=(C' C ','1C ', C' S ',C'2S ', C' P ',C'3P '))
and including your suggested code but shifting the last sort character to sort the now added preceding number.
CHALT would cause all of the CH fields to sort with the ALTSEQ changes. Since you only want position 19 to sort with the ALTSEQ changes, it's better to use AQ to sort just that field with the ALTSEQ changes.