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 Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

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