Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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
 
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: 2504
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 Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us