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 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: 7932
Location: Bellevue, IA

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: 2502
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: 7932
Location: Bellevue, IA

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: 2502
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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need a logic to validate the data in ... sandeep kumar302 COBOL Programming 17 Mon Feb 01, 2016 3:30 pm
No new posts pass numeric value of length 14 to ti... Ralph Zbrog Java & MQSeries 4 Fri Jan 15, 2016 3:20 pm


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