MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SORT utility failing to sort in a correct order.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
SK
Beginner


Joined: 04 Feb 2004
Posts: 26
Topics: 3

PostPosted: Mon Feb 09, 2004 2:55 pm    Post subject: SORT utility failing to sort in a correct order. Reply with quote

Hi,

I am sorting a file containing a column with the following type of data. It is a fixed block file and this is the first column in the file.

Data is as follows:

..0-A8CD
..1-108V
..1-109V
..B-239
..Z-2SL
..N-245

Sorted file is as follows:

..B-239
..Z-2SL
..N-245
..0-A8CD
..1-108V
..1-109V

Could anyone please let me know the reason for this.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Feb 09, 2004 3:24 pm    Post subject: Reply with quote

Sk,

I guess this is the continuation of the other topic where you had a problem with matching files. Btw are you able to fix the error ? You are eager to get an answer, but you don't show the same eagerness to post a feedback. posting a feedback helps in future searches if any one is dealing with the same problem.

One more thing please post the questions in the appropriate forum. The questions involving sort should be posted in "utilities" forum. I am moving this question to the utilities forum.

I remember that you are sorting the data as a character data. But if you look at the data the first 2 bytes are not displayable which makes me suspect that the data is either BINARY or COMP-3. so sorting this data as character data will not yield correct results.

open the input dataset in either browse mode or update mode

Type HEX ON at the command prompt

If the data is comp-3 you will find something like this
Code:

01
0C


i.e the 2 bytes have a value of 1 in packed decimal format

If the data is comp you will find something like this
Code:

00
01


i.e the 2 bytes have a value of 1 in binary format

In that case you need to sort on the numeric portion seperately.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Feb 09, 2004 4:07 pm    Post subject: Reply with quote

Note that you can also use a DFSORT job to see what the data looks like in hex, e.g.

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,2,HEX)
/*


As Kolusu says, depending on what the data looks like, you may need to use PD or BI format to sort it correctly.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group