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

Validation - integer in cobol CICS


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

New User


Joined: 25 Jun 2007
Posts: 40
Location: chennai

PostPosted: Fri Aug 03, 2007 2:19 pm
Reply with quote

validation for number field
whether they have entered any spaces???
how to check that in the code.
if they have entered a number and space i have to ignore the space if number has been entered.
Back to top
View user's profile Send private message
palas_08
Currently Banned

New User


Joined: 26 Feb 2007
Posts: 9
Location: kolkatta

PostPosted: Fri Aug 03, 2007 6:50 pm
Reply with quote

hi,

check num is numeric or not ?
u can move to x(3)
o1 gr.
02 num pic x(3).
02 num2 redefines num.
03 a occures 3 time pic x(1).

if a(1)=' '



and then u can check .

I think this will help u

with regards
palas
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 03, 2007 7:08 pm
Reply with quote

you can always use the numval function which will return either a number (spaces removed) or an error telling you that there are alpha characters.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Aug 03, 2007 7:53 pm
Reply with quote

You can also use the UNSTRING command
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 03, 2007 7:59 pm
Reply with quote

Hello,

If the user enters "123 45 ", what should happen?
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Aug 03, 2007 8:08 pm
Reply with quote

As stated by the question, if they enter a space he want to forget
the rest of the data in the field. if the field had bbb150 and the user
enter 275 over the bbb150 the field would look like 250b50 and
with the unstring you end up having just the 275.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 03, 2007 8:41 pm
Reply with quote

Hello,

Quote:
As stated by the question, if they enter a space he want to forget
the rest of the data in the field. if the field had bbb150 and the user
enter 275 over the bbb150 the field would look like 250b50 and
with the unstring you end up having just the 275.

That is one way to interpret the post. . . . Also, that when numbers are followed by spaces, the spaces should be ignored and the number properly scaled.

Which is why i posted the example with the embedded space. Should the space terminate the field, should the digits be combined into one number, or should it be an error?

We can only guess - any could be correct if the rule so defined. Maybe TS will clarify. . . .
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Aug 03, 2007 9:51 pm
Reply with quote

That is so TRUE....
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top