Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

dfsort help: sorting numeric fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: dfsort help: sorting numeric fields
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 Moderator


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

PostPosted: Fri Mar 04, 2005 10:20 pm    Post subject:
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:

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us