View previous topic :: View next topic
|
Author |
Message |
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
Code: |
//SYSIN DD *
SORT FIELDS=(133.1,.1,BI,A)
OUTREC FIELDS=(1:133,1)
/*
|
which byte it will take to sort ?
Code: |
3----+----4----+----5--
***********************
005 1DO
FFF10040000000044FCD444
00500100000000000146000
-----------------------
718Ø 1DO
FFF80040000000044FCD444
71800000000000000146000
-----------------------
818 1DO
FFF00040000000044FCD444
81800000000000000146000
-----------------------
268 1OO
FFF00040000000044FDD444
26810000000000000166000
----------------------- |
i have given input file for the sort ( starting form 130th column). |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
which byte it will take to sort ? |
arivazhagan.k
133.1,.1 specifies the second bit in the byte at position 133.
So any byte in position 133 with:
B'.0......'
will sort before any byte in position 133 with:
B'.1......'
where . is a 0 or a 1. Only the second bit matters. |
|
Back to top |
|
|
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
Code: |
10
00
--
Ø
80
00
--
00
00
--
00
10
--
Ø
80
00
--
Ø
80
00
--
Ø
80
00
--
Ø
80
00
--
Ø
80
00 |
As you said it should come like 0,1....
But output came like above .why? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
x'10' = b'00010000'
x'80' = b'10000000'
x'01' = b'00000001'
All of these have '0' in the second bit.
Maybe you should be sorting on 133,1,BI,A for the whole byte rather then just on one bit. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
The only digit that matters here is the first one (e.g 8 in X'8000') since it contains the second bit:
0 = B'0000'
1 = B'0001'
8 = B'1000'
These all have 0 in the second bit so they all sort equally. (4 = B'0100' has a 1 in the second bit so it would sort after these others.)
If you have EQUALS in effect, the output records will be in the same order as the input records. If you have NOEQUALS in effect, the output records can be in any order.
You don't seem to understand what your SORT statement does. Maybe it's not the SORT statement you actually need. Perhaps you should tell me what you're trying to do so I can tell you how to do it. |
|
Back to top |
|
|
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
Frank Yaeger,
Craq,
Thanks for both of you . |
|
Back to top |
|
|
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
Before you post that ans i tried with same sample data "4 = B'0100' ".
i am wondering.
Now i got it .Thanks for your valuable response. |
|
Back to top |
|
|
|