View previous topic :: View next topic
|
Author |
Message |
sameetshetty
New User
Joined: 19 Jan 2007 Posts: 11 Location: bangalore
|
|
|
|
hi,
I have a variable
ws-amount-ch pic x(18).
the data in this variable could be any of the foll.
Code: |
11111.01
22222
222222.12 |
All of the data in ws-amount-ch will be right justfied.
I have to do some computation using the ws-amount-ch field. Could any one please tell as too how can i use this variable to perform arithmatic operation. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
use
Code: |
INSPECT WS-AMOUNT-CH REPLACING ALL SPACES BY ZEROS.
|
|
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
sameet wrote
Quote: |
I have to do some computation using the ws-amount-ch field. Could any one please tell as too how can i use this variable to perform arithmatic operation. |
In order to perform arithmetic operations ,move the alphanumeric variable X(18) to numeric variable 9(18) and perform your desired arithmetic operations.After operations,if you need you can move it again to alpha numeric variable. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
perform arithmetic operations ,move the alphanumeric variable X(18) to numeric variable 9(18)
|
That is implied. You can not use alphanumerics in computation..
But you will have to first replace spaces in that variable, ..right? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
sameetshetty,
Unless you have the COBOL intrinsic function NUMVAL, you will have to replace the leading blanks and somehow align to and then squeeze out to decimal point.
Bill |
|
Back to top |
|
|
|