IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sorting a hexadecimal field.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 4:24 pm
Reply with quote

hi,

I have a hexadecimal field in my input file. I want to sort that file in that field in acending order. Can anyone help me in doing this? What type of format i have to use? I have only SYNCSORT in my shop.

I tried to sort the file with the format F, but it doesn't come correctly.

    AF
    A0
    A0
    A2
    BJ
    BM
    B8
    CA
    CH
    C1
    C4
    C4
    C5
    C5



Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 4:37 pm
Reply with quote

As far as it goes, there is no such thing as a hexadecimal field.
That said, "format F"?
Treat the two columns as character and it will sort just fine.
What order do you want vs what order did you get?
What do your sort control parms look like?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 4:42 pm
Reply with quote

hi,

My sort card looks like this.

Code:
SORT FIELDS=(21,10,CH,A)


I want the output like the following

A0
A0
A2
AF
B8
BJ
BM
C1
C4
C4
C5
C5
CA
CH

Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 4:49 pm
Reply with quote

A2
AF

B8
BJ

C5
CA

So for all 10 columns you want numerics to sort ahead of alphabetics?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 4:50 pm
Reply with quote

yes
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 4:58 pm
Reply with quote

Again, did you look in the manual?

Chapter 2. SyncSort Control Statements
Sample ALTSEQ Control Statements
ALTSEQ CODE=(F0B7,F1B8,F2B9,F3BA,F4BB,F5BC,F6BD,F7BE,F8BF,F9C0)
Figure 7. Sample ALTSEQ Control Statement
This sample ALTSEQ control statement shows that the numbers 0 through 9 are to collate
before the uppercase alphabet.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 5:09 pm
Reply with quote

Hi William,

Yes I have the manual and I looked into that. But the thing is how can i find the corresponding hex code for alphabets and digits? And i haven't ever used the ALTSEQ, a little bit hesistance as i am not aware of it. Could you help me how to find the hex code for alphabets and digits?
Thanks for your valuable information.

Thanks,
Bala
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 5:20 pm
Reply with quote

The posted example is exactly what you want:
"numbers 0 through 9 are to collate before the uppercase alphabet".
Just include it and you will get what you want.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jun 04, 2007 5:32 pm
Reply with quote

ok. Thanks William.

Thanks,
Bala
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 04, 2007 7:16 pm
Reply with quote

Hello,

While on the pc and unix systems, it is "normal" for numbers to sort ahead of letters. This is not true on the mainframe.

While you can force the sequence you want, you may have problems using it in your application programs. Anything that compares one value to another will compare the numbers as a higher value than the letters eventhought they are presented "out of order". Any "keys" in vsam or database will use the standard collating sequence, not the "ALTSEQ".

If the only reason for this sequence to is to download, you may be ok, but if the ALTSEQed output is to be used on the mainframe, there may be problems.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top