Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us