MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting CH v PD

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
chuck
Beginner


Joined: 30 Nov 2007
Posts: 25
Topics: 11

PostPosted: Fri May 12, 2023 2:47 pm    Post subject: Sorting CH v PD Reply with quote

Hi,
Posting on behalf of someone who is not very comfortable in forums and so on

Is there any real impact if you use PD or CH to sort signed packed decimal numbers?  I just ran a test and both sorted to the same ascending sequence.  Just wonder if that would ever bite us?

Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Sun May 14, 2023 7:42 am    Post subject: Reply with quote

chuck wrote:
Is there any real impact if you use PD or CH to sort signed packed decimal numbers? I just ran a test and both sorted to the same ascending sequence. Just wonder if that would ever bite us?

chuck,

You caNNOT sort packed decimal fields as character data as the sign(positive or negative) is in the lower nibble of the data.

For example , here is a sample data.
Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                             
-40000                                     
-60040                                     
+55000                                     
-20000                                     
+20000                                     
+30000                                     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                             
  INREC OVERLAY=(20:1,6,SFF,PD,LENGTH=6)   
  SORT FIELDS=(20,6,PD,A)                   
/*


Now change the sort fields to
Code:

SORT FIELDS=(20,6,CH,A)   
and see the order of the data.

The question is why do you want to sort the packed decimal data as character?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chuck
Beginner


Joined: 30 Nov 2007
Posts: 25
Topics: 11

PostPosted: Mon May 15, 2023 4:26 pm    Post subject: Reply with quote

I have conveyed your response to my coworker. Thank you very much. He gave me some complicated reasoning for wanting to do this, but with your example I was able to dissuade him!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group