View previous topic :: View next topic
|
Author |
Message |
grayWolf
New User
Joined: 04 Oct 2010 Posts: 19 Location: Land of broken dreams
|
|
|
|
Hi All,
There has been a lot of discussion on moving alphanumeric to COMP-3 variables in this forum and I went through them. But I could hardly find a topic which involved numbers with a decimal part. ( apologies if it was already discussed)
I have to move a number like 3.230000 which is in Alphanumeric part to a COMP-3 variable.
I tried a simple move like: MOVE (alphanumeric) to (comp-3)
So, only the decimal part (ie) 230000 was getting copied to the Comp-3 variable.
Can you suggest ways to do this?
Note: I'm getting the input from the CICS map and I have to update the DB2 table.
Thanks in advance |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is your decimal place in a fixed position?
If so, define/redefine the numeric parts. Define a "display numeric" with the size/decimals you want. Redefine that with integer and decimal parts.
Move the appropriate stuff from the input field to the redefined parts. Then move the whole new display numeric to your comp-3.
Code: |
01 W-INPUT-WITH-DECIMAL-PLACE.
05 W-IWDP-INTEGER-PART PIC X(6).
05 W-IWDP-DECIMAL-POINT PIC X.
05 W-IWDP-DECIMAL-PART PIC X(6).
01 W-FULL-NUMBER-WITH-SIX-DECIMALS PIC 9(6)V9(6).
01 FILLER REDEFINES W-FULL-NUMBER-WITH-SIX-DECIMALS.
05 W-FNWSD-INTEGER-PART PIC X(6).
05 W-FNWSD-DECIMAL-PART PIC X(6). |
Note: Your PIC X field will not hold enough digits for the full comp-3 you have defined. Might not be a problem.
I would check that the decimal place contains a fullstop/period.
I have used PIC X fields because they work without having to worry about what is happening with the signs.
If not in fixed position, look up intrinsic function NUMVAL in the manual and search the Cobol forum here. |
|
Back to top |
|
|
grayWolf
New User
Joined: 04 Oct 2010 Posts: 19 Location: Land of broken dreams
|
|
|
|
Thanks a lot Bill!
I referred the post and the logic involving COMPUTE NUMVAL worked. |
|
Back to top |
|
|
|