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

Validate for Alphanumeric


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MCEVOY

New User


Joined: 21 Nov 2005
Posts: 18

PostPosted: Fri Apr 24, 2009 4:09 pm
Reply with quote

I have to list all rows in a table that have values in a CHAR(10) column containing any character that is not alphanumeric.
Any bright ideas on how to code this in a Select Statement, or am I missing/forgetting something basic?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 24, 2009 4:56 pm
Reply with quote

as soon as you tell us what is NOT alphanumeric, a solution maybe forthcoming.
Back to top
View user's profile Send private message
MCEVOY

New User


Joined: 21 Nov 2005
Posts: 18

PostPosted: Fri Apr 24, 2009 5:04 pm
Reply with quote

Anything other than the latters A-Z and the numbers 0-9.
Thanks for your interest.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Fri Apr 24, 2009 5:04 pm
Reply with quote

Code:


SELECT COL FROM
(
SELECT COL,

CASE TRANSLATE(UPPER(COL), ' ','ABCDEFGHIJKLMNOPQRSTUVWXYZ') = ' '
THEN 1
ELSE 0
END AS VAL

FROM TABLE
) AS TEMP
WHERE VAL = 1 ;


this will give you only those values which are in range A - Z ...
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Fri Apr 24, 2009 5:06 pm
Reply with quote

Oops .. i missunderstud your last post ... do the changes accordingly ..
Back to top
View user's profile Send private message
MCEVOY

New User


Joined: 21 Nov 2005
Posts: 18

PostPosted: Fri Apr 24, 2009 5:09 pm
Reply with quote

Brilliant. I get the idea.
Thanks a million.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
No new posts Need to validate the field using cobol COBOL Programming 4
No new posts JSONVALID to validate the JSON PL/I & Assembler 4
No new posts Packed decimal to Alphanumeric COBOL Programming 2
No new posts Alphanumeric to Packed Decimal Conver... COBOL Programming 2
Search our Forums:

Back to Top