Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
arivazhagan_k

New User

Joined: 05 Dec 2007
Posts: 57
Location: chennai

Posted: Mon Mar 24, 2008 5:14 pm    Post subject: Sort by bits SORT FIELDS=(133.1,.1,BI,A)

 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).

Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Mon Mar 24, 2008 8:36 pm    Post subject:

 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.
arivazhagan_k

New User

Joined: 05 Dec 2007
Posts: 57
Location: chennai

Posted: Mon Mar 24, 2008 9:16 pm    Post subject:

 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?
Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

 Posted: Mon Mar 24, 2008 9:26 pm    Post subject: 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.
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

 Posted: Mon Mar 24, 2008 9:32 pm    Post subject: 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.
arivazhagan_k

New User

Joined: 05 Dec 2007
Posts: 57
Location: chennai

 Posted: Mon Mar 24, 2008 9:49 pm    Post subject: Frank Yaeger, Craq, Thanks for both of you .
arivazhagan_k

New User

Joined: 05 Dec 2007
Posts: 57
Location: chennai

 Posted: Mon Mar 24, 2008 9:53 pm    Post subject: 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Connect Direct - using DEBUG=TRACE Bits srajendran2 All Other Mainframe Topics 4 Tue May 08, 2018 3:08 am Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us