# Converstion of Char to PD

Author Message
Sikkandhar

New User

Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

Posted: Fri Apr 18, 2014 12:38 am

Hi,

I have a number populated in X(17). Have to convert to X(17) to S9(13)V9(5) COMP -3. I used the below command

 Code: 1:1000,17,ZD,TO=PDC,LENGTH=10,

The charector field starts from position 1000 and occupies 17 bytes. The last 4 bytes in X(17) are the decimal field.
When the value is Charector field is '00000000010000000', the value populated is 100.00000 instead of 1000.0000.

Thanks
Akatsukami

Global Moderator

Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

 Posted: Fri Apr 18, 2014 1:08 am Are you saying that the least significant digit of the packed decimal field should always be set to zero?
Sikkandhar

New User

Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

 Posted: Fri Apr 18, 2014 1:11 am yes. the least significant bit/5th decimal field should be set to zero.
Akatsukami

Global Moderator

Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

Posted: Fri Apr 18, 2014 1:48 am

Remember that in a packed decimal field there is no indication of the decimal point; you have to know where it is and code accordingly (in assembler), or define your variables to tell the compiler where it is.

(Remember also that COBOL terminology should only be used to describe COBOL problems.)

A simple way to get what you want is
 Code: 1:1000,17,ZD,MUL,+10,TO=PDC,LENGTH=10
Sikkandhar

New User

Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

 Posted: Fri Apr 18, 2014 2:02 am Thanks Akatsukami. Thanks for you solution it worked and it was simpler than the one i thought of. To use INREC and pad an extra zero to the 17 byte Char.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics COnvert a column with mix of hex ,cha... DB2 5 How do i verify the char field is hav... PL/I & Assembler 1 how to convert Hex String t char hex PL/I & Assembler 6 Insert System Runtime in HEADER In SY... SYNCSORT 9 how to do bit operations from CHAR PL/I & Assembler 3
Search our Forums:

 © 2003-2021  IBM Mainframes.com Technical Support Division Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us