IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Numeric Validation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nsuma

New User


Joined: 10 Dec 2007
Posts: 13
Location: Hyd

PostPosted: Sat Jan 05, 2008 12:55 pm
Reply with quote

Hi All,
I have to read the numeric value number by number to check is the valid numeric value or not.My numeric value pic clause is 9(5)v99 , the value from the file will be vary ...means it may be 1234, 1234567, 12, ab1234 or a123.......like this...so how to check the field is numeric or not by checking each position in the field basing on the size.
Back to top
View user's profile Send private message
suny_sn1

New User


Joined: 26 Jun 2007
Posts: 6
Location: India

PostPosted: Sat Jan 05, 2008 1:32 pm
Reply with quote

If Count-x is numeric then display “Data is good”

hope this helps
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sat Jan 05, 2008 5:35 pm
Reply with quote

Nsuma,

Quote:
My numeric value pic clause is 9(5)v99 , the value from the file will be vary ...means it may be 1234, 1234567, 12, ab1234 or a123.......like this...

First question, if you have declared var as number (as shown above).... how are you getting 'ab1234' value?????????


so how to check the field is numeric or not by checking each position in the field basing on the size.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sat Jan 05, 2008 5:36 pm
Reply with quote

Sorry about my prev post. Pressed submit button in hurry.


Nsuma,

Quote:
My numeric value pic clause is 9(5)v99 , the value from the file will be vary ...means it may be 1234, 1234567, 12, ab1234 or a123.......like this...

First question, if you have declared var as number (as shown above).... how are you getting 'ab1234' value?????????


Quote:
so how to check the field is numeric or not by checking each position in the field basing on the size.

Ans to your question, use 'class condition'. For syntax and usage, go thru cobol manuals.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jan 05, 2008 6:28 pm
Reply with quote

Hi Murali,

If the defined numeric var is part of a record read into an 01 group level var the numeric var could very well contain a blank in error. It could have been defined as an A/N var when it was originally created.

There are other variations on this scenerio, but this is probably the most likely.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sat Jan 05, 2008 8:14 pm
Reply with quote

Jack,

Quote:
If the defined numeric var is part of a record read into an 01 group level var the numeric var could very well contain a blank in error.

I agree with your statement.

Quote:
It could have been defined as an A/N var when it was originally created.

Only thing I can think is - BAD DESIGN (could be initial or changed one).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts Numeric check on packed signed and un... COBOL Programming 4
No new posts Numeric check w/SyncSort. SYNCSORT 1
Search our Forums:

Back to Top