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

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

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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm


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