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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm


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