IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Numeric check on Alphanumeric field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Thu Aug 05, 2010 7:58 pm
Reply with quote

Hi all,

I tried to use Search facility but could not find exact answer/solution.


01 WS-A PIC X(5)
01 WS-B PIC 9(5)

MOVE WS-A TO WS-B

I want to keep a test on WS-A, if this has got non numeric field then I want to move zeroes to WS-B. I am doing this to avoid S0C7 if bad data arrives.

Can I use function NUMVAL to prepare my solution?

Or, it would require verifying each CHAR on WS-A?

Many thanks,
zh_lad
Back to top
View user's profile Send private message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Thu Aug 05, 2010 8:05 pm
Reply with quote

More simpler approcah would be to Move WS-A to WS-B and perform IS NUMERIC check for WS-B. If it fails move ZEROS to WS-B else continue with your processing.

Let us know if you are looking for anything more on this.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 05, 2010 8:05 pm
Reply with quote

Why not
Code:
IF  WS-A NUMERIC
    MOVE WS-A TO WS-B
ELSE
    MOVE ZERO TO WS-B
END-IF.
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Thu Aug 05, 2010 8:11 pm
Reply with quote

Thanks for quick reply. I will use keyword NUMERIC to test content. Many thanks. Cheers!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top