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
 

 

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: 7251

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: 6966
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: 7251

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 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
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
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am


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