View previous topic :: View next topic
|
Author |
Message |
vrkpati
New User
Joined: 18 Jun 2007 Posts: 7 Location: hyderabad
|
|
|
|
Hi,
I have a i/p file that contains the imbedded decimal point X'4B' How do I convert the data to numeric to perform arithmetic operations and then reconvert the data back to a -9(9).99 before writing the record.
In my record i have values like
ws-amount --- declared as x(7) justified right.
ws-amount --- field values are as follows
-500.00
100.00
-200.00
I want to get the total sum of ws-amount.... means my output
should be -600.00 after computation
how do I convert ws-amount to a fully numeric field, perform arithmetic on it and then write the result back out. |
|
Back to top |
|
|
vrkpati
New User
Joined: 18 Jun 2007 Posts: 7 Location: hyderabad
|
|
|
|
my compiler not taking NUM-VAL function |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Post in BBcode format the first couple of lines from any page of your compiler output so we can know which version of COBOL you're dealing with.
Also, it is not NUM-VAL it is NUMVAL. And post the code where you tried to use it to see what the compiler thinks about it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
At the top of the page is a link to "IBM Manuals".
Suggest you look at both NUMVAL (as Robert mentioned) and NUMVAL-C in the Language Reference that is for your compiler. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
vrkpati
New User
Joined: 18 Jun 2007 Posts: 7 Location: hyderabad
|
|
|
|
ws-amount --- field values are as follows
-500.00
100.00
-200.00
to use ws-amount in compute or in add i need to convert it to s9(6)v99 from -9(6).99 how to do that ?? with out using NUMVAL function |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
with out using NUMVAL function |
And this is a requirement because. . . ?
You can use the features of the compiler or you can do it "by hand", parsing each byte in code and "building" the needed value. |
|
Back to top |
|
|
vrkpati
New User
Joined: 18 Jun 2007 Posts: 7 Location: hyderabad
|
|
|
|
I didn't get you exactly
I got compile error with NUMVAR function. (can't tell u my compiler error now as there is no connection now) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I got compile error with NUMVAR function. |
Because you did not use a valid function. . . Where did you get NUMVAR?
Quote: |
I didn't get you exactly |
What did you "not get"? That is like posting "it didn't work" - providing nothing for us to work with. . . |
|
Back to top |
|
|
|