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

dfsort help: sorting numeric fields


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
priyabrata mohanty

New User


Joined: 04 Mar 2005
Posts: 8
Location: bangalore

PostPosted: Fri Mar 04, 2005 7:35 pm
Reply with quote

hi,
i want to sort a ps with the following format: (fixed length record-80 bytes)

empid-4 bytes empname:10 bytes empsal:5 bytes empdept:4bytes

ex:- e010markxxxxxx30000hrd
e002philipxxxx40000it

i want to sort the file based on sortkey:empsal in ascending order. so if i specify sort fields=(15,5, PD, A) or (15,5,BI,A) or (15,5,ZD,A) instead of (15,5,ch,A) will it work? if so whats the difference between these formats?

thanks in advance.
regards,
priyabrata mohanty.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Mar 04, 2005 10:20 pm
Reply with quote

PD, BI, ZD and CH are different DFSORT formats that correspond to different internal representations of values.

BI is binary format - it can be used to sort unsigned binary values of any type.

CH is character format - it can be used to sort character data.

PD is packed decimal - it can be used to sort signed decimal data in the form X'dd...ds' where d is a digit (0-9) and s is a sign (usually C or F for positive values or D for negative values).

ZD is zoned decimal - it can be used to sort signed decimal data in the form X'zdzd...sd' where z (the zone - usually F) is ignored, d is a digit (0-9) and s is a sign (usually C or F for positive values or D for negative values).

In your case, your salary field is unsigned and contains digits of the form X'Fd'. You can sort this type of data correctly with ZD, CH or BI format.

You cannot sort this type of data correctly with PD format because it is not a PD value. For example, the value X'F3F0F0F0F0' is in the correct X'zdzdzdzdsd' format for ZD, but is not in the correct X'ddddddddds' format for PD (e.g. F is not a 0-9 digit as expected).

Note that values like X'F3F0F0F0F0', X'F5F0F0F0C2' and X'F3F0F0F0D0', etc could be sorted correctly with ZD, but not with CH or BI because of the sign. With ZD format, the F, C and D signs are interpreted correctly, whereas with BI and CH, they aren't.

CH and BI are generally interchangeable for sorting unless you are using a parameter that affects CH but not BI such as CHALT or LOCALE.

For more information on the various formats supported by DFSORT, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/C.0?DT=20050222160456
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts Pull data using date difference betwe... DB2 6
No new posts DFSORT GUID DFSORT/ICETOOL 5
Search our Forums:

Back to Top