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 Usergroups Profile Log in to check your private messages Log in
 

 

Numeric decimal value to Alphanumeric variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
meenakshi_forum
Warnings : 1

Active User


Joined: 27 May 2008
Posts: 121
Location: India

PostPosted: Thu Feb 11, 2010 7:27 am    Post subject: Numeric decimal value to Alphanumeric variable
Reply with quote

Hi All,

Suppose there is 999V99, eg. 123.45 and it has to be moved to x(5) then how will it be stored internally?

Thanks.
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 11, 2010 8:13 am    Post subject: Reply to: Numeric decimal value to Alphanumeric variable
Reply with quote

Based upon your example PIC and assuming this is display-numeric and NOT packed-decimal, the decimal position is implied (it doesn't exist) and the data occupies five-bytes. Therefore, after a move to a PIC X(05) field, it would still equal '12345' (X'F1F2F3F4F5'), but you would lose the implied decimal position.

If you were going to move it to a PIC X(05) field, then use reference modification, which will ensure that the data remains as-is.

EG -

Code:

03  WS-DECIMAL PIC 999V99 VALUE 123.45.
03  WS-ALPHA   PIC X(05).

MOVE WS-DECIMAL (1:) TO WS-ALPHA (1:).

Bill
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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