MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

validation logic

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Wed Sep 06, 2006 6:08 am    Post subject: validation logic Reply with quote

My requirement is validate user name as per the following criteria------ user name should not have other characters other than a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,&,",',#,(,),* ----- can any one say ho to handle this with minimum code lines (cpu usage).
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 317
Topics: 50
Location: Germany

PostPosted: Wed Sep 06, 2006 6:20 am    Post subject: Reply with quote

Which programming language?
Back to top
View user's profile Send private message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Wed Sep 06, 2006 6:33 am    Post subject: Reply with quote

COBOL
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Sep 06, 2006 7:16 am    Post subject: Reply with quote

syam,

Try this code
Code:

IDENTIFICATION DIVISION.                               
PROGRAM-ID.    SAMPLE                                   
ENVIRONMENT DIVISION.                                   
CONFIGURATION SECTION.                                 
SPECIAL-NAMES.                                         
   CLASS ALPHA-NUM IS 'A' THRU 'Z' ,                   
                      'a' THRU 'z' ,                   
                      '0' THRU '9' ,                   
                      ' ', '&', '"',                   
                      '#', '(', ')',                   
                      '*', ''''.                       
                                                       
DATA DIVISION.                                         
WORKING-STORAGE SECTION.                               
01 WS-INPUT                 PIC X(30).                 
                                                       
PROCEDURE DIVISION.                                     
                                                       
    MOVE 'SYAM$'   TO WS-INPUT                         
                                                       
    IF WS-INPUT IS ALPHA-NUM                           
       DISPLAY 'THE STRING CONTAINS VALID CHARACTERS'   
    ELSE                                               
       DISPLAY 'THE STRING CONTAINS INVALID CHARACTERS'
    END-IF                                             
                                                       
    GOBACK.                                             


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Wed Sep 06, 2006 7:41 am    Post subject: Reply with quote

Thanks a lot Very Happy
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
Grant
Beginner


Joined: 02 Dec 2002
Posts: 45
Topics: 1
Location: Sydney, NSW, Australia

PostPosted: Wed Sep 06, 2006 5:38 pm    Post subject: Reply with quote

ALPHA-NUM should be defined as
Code:

A' thru 'I'
'J' thru 'R'
'S' thru 'Z'
'a' thru 'i'
'j' thru 'r'
's' thru 'z'


Specifying 'A' thru 'Z' will allow x'CA' --> x'CF' and x'DA' --> x'E1' to be accepted
Specifying 'a' thru 'z' will allow x'8A' --> x'8F' and x'9A' --> x'A1' to be accepted
Back to top
View user's profile Send private message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Thu Sep 07, 2006 10:41 am    Post subject: Reply with quote

Grant Can you elobrate what x'CA' --> x'CF' and x'DA' --> x'E1' and x'8A' --> x'8F' and x'9A' --> x'A1' , how ever my work is done with kolusus approach
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Thu Sep 07, 2006 12:47 pm    Post subject: Reply with quote

just look at a chart of the EBCDIC character set and you will see what he means
Back to top
View user's profile Send private message Visit poster's website
Grant
Beginner


Joined: 02 Dec 2002
Posts: 45
Topics: 1
Location: Sydney, NSW, Australia

PostPosted: Sun Sep 10, 2006 7:57 pm    Post subject: Reply with quote

Specifying
Code:
CLASS ALPHA-NUM IS 'A' THRU 'Z'
allows for any value between 'A' and 'Z' to be accepted, i.e. x'C1' to x'E9'.

The problem is

'A' thru 'I' corresponds to x'C1' thru x'C9'
'J' thru 'R' corresponds to x'D1' thru x'D9'
'S' thru 'Z' corresponds to x'E2' thru x'E9'

This means hex values of CA, CB, CC, CD, CE, CF, DA, DB, DC, DD, DE, DF, E1 will be accepted as valid when they should not.

This also applies to lower case a-z, the only difference being the hex range is
81 thru A9
Back to top
View user's profile Send private message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Mon Sep 11, 2006 1:20 am    Post subject: Reply with quote

Thank you
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group