Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
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
 
Convert Packed decimal to Numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
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    Post subject: Convert Packed decimal to Numeric
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    Post subject:
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    Post subject:
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: 2360
Location: Israel

PostPosted: Sun Jun 21, 2009 5:21 pm    Post subject:
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    Post subject: Reply to: Convert Packed decimal to Numeric
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    IBMMAINFRAMES.com Support Forums -> Java & MQSeries 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 Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us