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
 
How to check the Numeric in Char field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
Ragav86

New User


Joined: 27 Jan 2010
Posts: 37
Location: chennai

PostPosted: Wed Mar 14, 2012 6:20 pm    Post subject: How to check the Numeric in Char field
Reply with quote

Hi how to check Numeric condition on char field.. can any one help this..

Code:

PARM      DEBUG (DMAP PMAP)       
FILE TEST                         
TEST1 1 3 A                       
*                                 
WS-DATA W 2 A                     
*                                 
WS-D   W 2 N                     
*                                 
JOB INPUT(NULL)                   
WS-DATA = '0 '                   
IF WS-DATA NUMERIC               
 DISPLAY WS-DATA ' NUMERIC'       
ELSE                             
 DISPLAY WS-DATA 'NOT NUERIC'     
END-IF                           
                                 
MOVE WS-DATA TO WS-D             
IF WS-DATA NUMERIC               
 DISPLAY WS-DATA ' NUMERIC'       
ELSE                             
 DISPLAY WS-DATA 'NOT NUERIC'     
END-IF                           


Output:
Code:

0 NOT NUERIC
0 NOT NUERIC
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Mar 14, 2012 8:57 pm    Post subject: Reply to: How to check the Numeric in Char field
Reply with quote

There must be something I'm missing. You've already done it.

"0 " (zero followed by blank) is not NUMERIC. Your snippet displays "NOT NUMERIC" twice, as it should.

So, what is your problem?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 14, 2012 9:15 pm    Post subject:
Reply with quote

Code:
DISPLAY WS-DATA ' NUMERIC'       
DISPLAY WS-DATA 'NOT NUERIC'


possibly Ragav86 has overlooked the fact that when NUMERIC is true
the literal has an embedded space,

whereas when
Quote:
NOT NUERIC
there is no leading space in the literal.

all things considered, you are correct Bill,
but
Code:

0 NOT NUERIC
0 NOT NUERIC


Ragav86 does not see two spaces, only one, and it is because his literals are not defined the same.

that and he misspelled numeric in the NOT literal.......
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Mar 14, 2012 9:25 pm    Post subject: Reply to: How to check the Numeric in Char field
Reply with quote

Good spot dbz. I can't make any more sense of it than that...

Looking further, the second IF still tests the original field, not the place it has been MOVEd to.

MOVE in Easytrieve is an interesting sort of thing. If you do it at field level it does a MOVE without any conversion, as though both/all fields are defined as A. This can readily trip those used to the way MOVE works in Cobol.

Personally, for fields, I'd always use assignments (=) (other than when you need to use a MOVE :-) ).
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 1 Thu Dec 14, 2017 5:46 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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