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 validate a pic s9(9)v99 if it is numeric.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
lizzy

New User


Joined: 28 Jul 2008
Posts: 3
Location: Philippines

PostPosted: Wed Jul 30, 2008 8:08 pm    Post subject: How to validate a pic s9(9)v99 if it is numeric.
Reply with quote

Hello there.. can I ask how to validate a pic s9(9)v99 if it is numeric.. and can it be redefined as a picture x with the sign still in it?
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jul 30, 2008 8:16 pm    Post subject:
Reply with quote

Why do you think you have to redefine it?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jul 30, 2008 8:22 pm    Post subject:
Reply with quote

If you just want to know if the field is numeric, IF <var name> NUMERIC works fine. If you want to guarantee it to be numeric, use BIF DEEDIT. And I'm not sure what you mean by
Quote:
and can it be redefined as a picture x with the sign still in it?
since you can definitely redefine the field as PIC X(11), and the sign won't be touched. Of course, if you start using the PIC X field like it's a numeric field, the sign overlay may cause problems.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 30, 2008 8:42 pm    Post subject: Re: validating number
Reply with quote

One little "opportunity" with COBOL validating signed-numeric fields is that if it's defined as signed, but yet (as a possibility in this example), the zone-nibble of the last byte contains a 4-Bit "F" instead of a 4-Bit "C" or "D", it may fail the NUMERIC test.

I've seen this happen with signed packed-decimal which had an "F" sign-nibble, so it may also occur with display-numeric signed.

Regards,

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jul 30, 2008 9:18 pm    Post subject:
Reply with quote

Bill, that'll depend on the NUMPROC setting for the compile and the site NUMCLS setting. Depending on how these are set, the 4-bit 'F' may or may not cause the NUMERIC test to fail. Good catch!
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 30, 2008 9:31 pm    Post subject: Re: validating number
Reply with quote

Robert,

Yeah that's true. However, I've always recommended the default NUMPROC(NOPFD) to all of our programmers.

I'd rather see a "CP" get an equal condition (or a SOC7) rather than NUMPROC(PFD) get a non-equal with a "CLC", because you won't get a SOC7 with a "CLC" until later on down the road when some TRUE arithmetic instruction is used. icon_wink.gif

IMHO, NUMPROC(PFD) can hide potential bad data, unless of course, data-integrity has been assured beforehand.

Regards,

Bill
Back to top
View user's profile Send private message
lizzy

New User


Joined: 28 Jul 2008
Posts: 3
Location: Philippines

PostPosted: Thu Jul 31, 2008 8:18 pm    Post subject: Numeric test failed
Reply with quote

Thank you for all your replies. I am really beginner on cics programming. Your right Bill my variable failed the 'is numeric' test. What I am thinking is in its BMS map the picin is not defined, so it will be a pic x then move it in pic s9 after checking it byte per byte excluding the sign? What do you think?

Also what is the best way of removing trailing spaces of a number inputted by a user in a map? Inspect keyword doesn't work in cics.

I'll check my compiler tomorrow.

I really appreciate all your help!!

Thanks guys icon_biggrin.gif
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 -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

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