View previous topic :: View next topic
|
Author |
Message |
gr_mohanram
New User
Joined: 02 Aug 2003 Posts: 5
|
|
|
|
We have been searching a solution to create a COBOL program which allows to convert a string input entry
to a numeric with format indications like examples below :
Input entry
"123" or "123.56" or ...
"999" or "999.99" or... (Output format wanted)
Output entry
123 or 123.56 or ...
We don't found any solution on the web (despite our's efforts), do someone
have a solution for this ?
Thanks in Advance,
Mohan. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Do you mean to remove quotes (") from the inout string & place the numeric value only to output string.
Regards,
Priyesh. |
|
Back to top |
|
|
gr_mohanram
New User
Joined: 02 Aug 2003 Posts: 5
|
|
|
|
We found to resolve,
The follwoing is the resolution..
Example 1
77 ALPHA-NUM PIC X(16) VALUE "$ 123.45 CR ".
77 NUM PIC S9(5)V99.
PROCEDURE DIVISION.
010-PARA.
COMPUTE NUM = FUNCTION NUMVAL-C (ALPHA-NUM).
DISPLAY ALPHA-NUM.
DISPLAY NUM.
STOP RUN.
The above example displays the following:
$ 123.45 CR
-00123.45
Thanks for your efforts... |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Mohan,
I still didnt get ..whether ur prob resolved now.....
If not... Plz give input & output string....
Regards,
Priyesh. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Mohan,
You didn't solve the whole problem you stated.
Using your solution for "123", I'm pretty sure DISPLAY NUM would produce 0123.00 not 123 |
|
Back to top |
|
|
|