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
 

 

Numeric check on Alphanumeric field

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

New User


Joined: 06 Jun 2009
Posts: 95
Location: UK

PostPosted: Thu Aug 05, 2010 7:58 pm    Post subject: Numeric check on Alphanumeric field
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    Post subject: Numeric check on Alphanumeric field
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: 7929
Location: Bellevue, IA

PostPosted: Thu Aug 05, 2010 8:05 pm    Post subject:
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

New User


Joined: 06 Jun 2009
Posts: 95
Location: UK

PostPosted: Thu Aug 05, 2010 8:11 pm    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm


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