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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am

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