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 

How to convert a rec with PD to Decimal and ignore the sign

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


Joined: 21 Jun 2011
Posts: 5
Topics: 2

PostPosted: Fri Aug 26, 2011 11:11 am    Post subject: How to convert a rec with PD to Decimal and ignore the sign Reply with quote

Hello, If I have a 116 byte record where all bytes are numeric (F0 to F9) except 2 areas that contain packed decimal (at positions 10 and 30 for a length of 3 bytes each), how do i convert the whole record to decimal display. so if the PD area was X'00010F' I want to display (convert) to F0F0F0F1F0, but if the PD area was X'00010D', I still want to display (convert) to the same output, eg F0F0F0F1F0 (the sign could be C,F or D). The fact that is -ve in some cases doesn't matter to me. I can use DFSORT / ICETOOL at my site. Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 26, 2011 12:04 pm    Post subject: Reply with quote

JediKnight,

3 byte pd field needs 6 bytes of display field ignoring the sign. Where do you want the output to be?

Either way you can use the following syntax to convert the pd field into displayable format

Code:

p,l,PD,EDIT=(TTTTTT)

P = position of the PD field
l = length of the PD field

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


Joined: 21 Jun 2011
Posts: 5
Topics: 2

PostPosted: Fri Aug 26, 2011 5:36 pm    Post subject: Reply with quote

OK thanks - doesn't a 3 byte packed decimal field convert to a 5 byte display field ?
x'12345F' -> F1F2F3F4F5
I want to output the whole record as-is, except I need to convert the PD area to ZD within it.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 26, 2011 5:44 pm    Post subject: Reply with quote

JediKnight wrote:
OK thanks - doesn't a 3 byte packed decimal field convert to a 5 byte display field ?


Yes it does if you ignore the sign.

You can use the following DFSORT JCL which will give you the desired results. Note that the output length will be increased by 4 bytes making it 120 byte file.

Code:

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=Your input file,DISP=SHR
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  OUTREC BUILD=(1,9,                                       
                10,3,PD,EDIT=(TTTTT),                       
                13,17,                                     
                30,3,PD,EDIT=(TTTTT),                       
                33,84)                                     
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Aug 26, 2011 6:17 pm    Post subject: Reply with quote

Quote:
OK thanks - doesn't a 3 byte packed decimal field convert to a 5 byte display field ?
x'12345F' -> F1F2F3F4F5
I want to output the whole record as-is, except I need to convert the PD area to ZD within it.


FWIW:

A 3-byte PD field can be converted to a 5-byte ZD field and retain the sign, e.g.

Code:

PD           ZD
X'12345F' -> F1F2F3F4F5
X'12345D' -> F1F2F3F4D5
X'12345C' -> F1F2F3F4C5


A 3-byte PD field can only be converted to a 5-byte display field if you don't display the sign:

Code:

PD            Display
X'12345D' -> 12345 (sign lost)
X'12345D' -> -12345 (sign kept)

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JediKnight
Beginner


Joined: 21 Jun 2011
Posts: 5
Topics: 2

PostPosted: Sat Aug 27, 2011 3:25 am    Post subject: Reply with quote

Thats great - I understand why you said 6 bytes now if I wanted the sign (which I don't in this case). Many thanks for replying.
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