View previous topic :: View next topic
|
Author |
Message |
FWY Currently Banned New User
Joined: 23 Oct 2006 Posts: 10
|
|
|
|
Hello, Sir.
Could you please advise what's the better way when 'moving alphanumeric character to numeric value ' ?
One way: determine if the alphanumeric just only contains numeric value.
Cobol sentence: IF WORK-PM IS NUMERIC then ...
Another way: use NUMVAL function(A question, is there any other Function? )
Cobol sentence: COMPUTE WORK-PM = FUNCTION NUMVAL(WORK-AM) then...
What's the better way and is there any other better function than NUMVAL ?
Thanks. |
|
Back to top |
|
|
ranjitbhingare
New User
Joined: 30 Nov 2005 Posts: 94 Location: PUNE
|
|
|
|
Hi,
I do work with IBM and most of the time we use
IF WS-VARIABLE IS NUMERIC
STATEMENTS
END-IF.
Regards,
Ranjit |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
I also agree with Renjith we usually used IS NUMERIC |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
If your source field only contains 0-9 and/or valid sign, the IF NUMERIC will work. But if your source field contains an edited numeric value (leading or trailing spaces, the IF NUMERIC will fail; if you need to extract valid numeric data from an alpha-numeric field, you have to use NUMVAL or NUMVAL-C |
|
Back to top |
|
|
|