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

how to validate a field in a map?


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sindhu_raghu
Currently Banned

New User


Joined: 18 Mar 2009
Posts: 7
Location: trichy

PostPosted: Sat Mar 21, 2009 4:52 pm
Reply with quote

how to validate a field in a map?
suppose if the field in a map contains a phone number, how to check whether its number or not ?
i have given the code as

ELSE IF CPHNOL = 0 OR CPHNOI IS NOT NUMERIC THEN
MOVE 'CUSTOMER PHONE NUMBER IS INVALID' TO MSGO

but its not working
where CPHNOL is phone number field
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Mar 21, 2009 5:12 pm
Reply with quote

Quote:
but its not working


the symptom is a bit generic ... don' t You think so?
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: Sat Mar 21, 2009 10:18 pm
Reply with quote

Hello,

The first order of business is to define the rules for what constitutes a valid phone number. Then you need to implement code that enforces all of the rules.

Quote:
but its not working
As mentioned - you provided nothing to help anyone help you. . . Posting "it didn't workig" simply wastes everyone's time.

Does the code complie correctly? Does the code abend? Does the code throw some programmed error (like the one you show in the bit of code)?

You need to post what the input contained and the result from that input.
Back to top
View user's profile Send private message
sindhu_raghu
Currently Banned

New User


Joined: 18 Mar 2009
Posts: 7
Location: trichy

PostPosted: Sat Mar 21, 2009 10:28 pm
Reply with quote

yeah thats code is not abending and its not giving compiler error

but the validation is not done properly
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Sat Mar 21, 2009 10:31 pm
Reply with quote

What is the definition of CPHNOL and what does it contain?
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: Sat Mar 21, 2009 10:42 pm
Reply with quote

Hello,

Quote:
but the validation is not done properly
You need to post the definition of "properly". If the rules are not known it just wastes time.

Show what values you use as input and what should happen for each input used. FWIW - the posted code does very little to validate a phone number. . .

Do not post "it is not working". . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Mar 21, 2009 11:18 pm
Reply with quote

Quote:
ELSE IF CPHNOL = 0 OR CPHNOI IS NOT NUMERIC THEN
MOVE 'CUSTOMER PHONE NUMBER IS INVALID' TO MSGO

but its not working
where CPHNOL is phone number field
Actually, I presume CPHNO is the map field -- CPHNOL would be the length attribute while CPHNOI would be the input map field. It appears you're checking to see if the field was not input (length of zero) or if the field is not numeric. That's not much of a validation routine, and you can't really tell which condition triggered the message. I suggest having one validation IF with message, then another validation IF with message so you can tell which condition is triggering a message. Something like:
Code:
ELSE IF CPHNOL = 0
          MOVE 'CUSTOMER PHONE NUMBER NOT INPUT' TO MSGO
     ELSE IF CPHNOI IS NOT NUMERIC THEN
          MOVE 'CUSTOMER PHONE NUMBER NOT NUMERIC' TO MSGO
Furthermore, most countries have pretty extended rules for what is a phone number that can be used for validation.
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top