Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Better way when 'moving alphanumeric character to numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
FWY
Currently Banned

New User


Joined: 23 Oct 2006
Posts: 10

PostPosted: Wed Nov 01, 2006 3:36 pm    Post subject: Better way when 'moving alphanumeric character to numeric
Reply with quote

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
View user's profile Send private message

ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed Nov 01, 2006 3:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Nov 01, 2006 7:29 pm    Post subject:
Reply with quote

Hi There,

I also agree with Renjith we usually used IS NUMERIC
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Nov 01, 2006 10:13 pm    Post subject: Re: Better way when 'moving alphanumeric character to numeri
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us