Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts Continuation Character ballaswaroop SYNCSORT 8 Thu Aug 25, 2016 4:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us