Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Count a particular record in a... Mounika Nemani DFSORT/ICETOOL 5 Tue May 29, 2018 1:07 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts Need urgent suggestion on DFSORT subratarec DFSORT/ICETOOL 6 Wed Mar 21, 2018 8:46 pm
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us