IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert Packed decimal to Numeric


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paandians

New User


Joined: 25 Feb 2009
Posts: 2
Location: chennai

PostPosted: Tue Jun 16, 2009 7:07 pm
Reply with quote

Hi ,
I have an input file with a field of format (P11,2).
I have write this to an output file , but it is not being done correctly.
How should we convert this data so that the exact values can be displayed in the output file rather than some special characters .

If it has to be converted to numeric . Please tell me how the conversion should be done before I write it to the output file.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Jun 16, 2009 7:18 pm
Reply with quote

If you are using a COBOL program, just move the packed decimal variable into a numeric field and then try to write to output file.

or you can use a SORT card to convert the packed value to numeric.
Back to top
View user's profile Send private message
paandians

New User


Joined: 25 Feb 2009
Posts: 2
Location: chennai

PostPosted: Tue Jun 16, 2009 7:28 pm
Reply with quote

Hi Arvind ,

Thanks for the reply , but I am not working in COBOL. This is for a NATURAL program . I missed mentioning that in the previous post.
I have tried moving to a numeric field but the display in the output is still not proper.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sun Jun 21, 2009 5:21 pm
Reply with quote

Have you tried to display it with the Edit-Mask (EM=) option?

O.
Back to top
View user's profile Send private message
Ralph Zbrog

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Fri Dec 11, 2009 12:52 pm
Reply with quote

When you write a packed field to a WORK file, the output record will contain the field in packed format. If you want to write the value as external decimal (unpacked), then you must explicitly convert the value with a temporary variable. WRITE WORK does not allow format specifications nor edit masks.

Code:
DEFINE DATA LOCAL
1 REC
  2 #ALPHA (A10)
  2 #DATE (A10)
  2 #PACKED (P11.2)
1 #NUMERIC (N11.2)
END-DEFINE
ASSIGN #NUMERIC = #PACKED
WRITE WORK 1 #ALPHA
             #DATE
             #NUMERIC
END
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top