Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To find rows which is NOT Alphanumeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
bbharathiraj
Warnings : 1

New User


Joined: 26 Oct 2006
Posts: 50
Location: Chennai

PostPosted: Mon May 25, 2009 9:39 pm    Post subject: To find rows which is NOT Alphanumeric
Reply with quote

Dear Everybody,

Please help me to resolve the below issue.

I have one table with 2 columns. Both columns having some non alphanumeric values. (other than A-Z and 0-9 and space).

I would like to find all the rows if any of the columns(col1,col2) value (character by character) is not A-Z or 0-9 or spaces.

For example,
Code:

Col1                     Col2
-----------             --&..JOHN
USA                     SMITH
--^&INDIA           CATHY
GERMANY             ---%$LARA


in output, I want to fetch the below rows.


----------- --&..JOHN
--^&INDIA CATHY
GERMANY ---%$LARA[/code]

Also is there anyway to update all these character (other than A-Z,spaces,0-9) to spaces.

The below query can use to fetch the values only non alpha (not A-Z) from only one column.

SELECT COL FROM
(
SELECT COL,

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

FROM TABLE
) AS TEMP
WHERE VAL = 1 ;

I would like to know the query to fetch rows by checking both col1,col2.
Also please provide me the query to update all the invalid character(other than A-Z and 0-9) in all rows to spaces.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 26, 2009 6:38 am    Post subject:
Reply with quote

as you guessed already,
If there is any volume at all (over 1000 rows on table) your best bet is to dump the file and use SORT, REXX or COBOL to change, then reload,

send a PM to Dick and ask him to lock this thread and reopen your SORT thread
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue May 26, 2009 6:50 am    Post subject: Reply to: To find rows which is NOT Alphanumeric
Reply with quote

Anticipated and done icon_smile.gif

The other topic has been re-opened. . .

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us