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

Numeric decimal value to Alphanumeric variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 11, 2010 8:13 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top