View previous topic :: View next topic
|
Author |
Message |
santhoshm
New User
Joined: 13 Jun 2007 Posts: 32 Location: chennai
|
|
|
|
Hi,
I have an input file with data as below
abc AA GROSS
abc 16 GROSS
abc BH GROSS
abc 72 GROSS
abc 68 GROSS
abc 24 NET
I will need output like below
abc 16 GROSS
abc 68 GROSS
abc 72 GROSS
abc AA GROSS
abc BH GROSS
abc 24 NET
I have used SORT FIELDS=(8,5,CH,A,5,2,CH,A) but I got result like below.
abc AA GROSS
abc BH GROSS
abc 16 GROSS
abc 68 GROSS
abc 72 GROSS
abc 24 NET
Is there anyway we can get the desired results using SORT fiels ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Perhaps if you explain clearly the order that you want. You want to Sort on GROSS/NET, then numbers followed by alphas? |
|
Back to top |
|
|
santhoshm
New User
Joined: 13 Jun 2007 Posts: 32 Location: chennai
|
|
|
|
Yes. The order is first it should sort by GROSS/NET and then field at 4th position of 2 characters. |
|
Back to top |
|
|
santhoshm
New User
Joined: 13 Jun 2007 Posts: 32 Location: chennai
|
|
|
|
Sorry 2nd order position starts at 5th with 2 bytes. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
look at the sort manuals on how to define an alternate character sequence |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
It looks like you are expecting SORT to be based on ASCII rather than EBCDIC, so I'd suggest you look at ALTSEQ processing.
Garry. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Consult your documentation. Look in the index for "collating sequence". In DFSORT ALTSEQ is your answer. With that you could change all the numbers, for the purpose of the sequencing only (not changing the data itself) to hex-values "lower" than "A".
EDIT: It seems we all agree :-) |
|
Back to top |
|
|
santhoshm
New User
Joined: 13 Jun 2007 Posts: 32 Location: chennai
|
|
|
|
Thank you all very much for your idea..
It worked with follwoing SORT card:
SORT FIELDS=(8,3,CH,A,5,2,AQ,A)
ALTSEQ CODE=(F0A0,F1A1,F2A2,F3A3,F4A4,F5A5,F6A6,F7A7,F8A8,F9A9)
SUM FIELDS=NONE |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks for letting us know. Now you've done your research and tested it, it is probably best to go with what Garry suggested if EBCDIC to ASCII is available (in ASCII the numbers come before the letters, and they even "mess around" with lower-case :-) ). |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
why not try with the AC format , the ASCII sequence ?
special chars
numbers
lower case
upper case |
|
Back to top |
|
|
|