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

Default alphanumeric field to asterisks using Case Statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arraiyan.parveen
Warnings : 1

New User


Joined: 10 Feb 2010
Posts: 5
Location: chennai

PostPosted: Thu Oct 21, 2010 4:55 pm
Reply with quote

Hi! Can anyone tell me on how to convert spaces, low values, high values on alphanumeric fields to asterisks using a case statement in the select query.

suppose in the below query the CLIENT_ID field is alphanumeric

SELECT WH_BUS_DT
,CLIENT_ID
,ACCT_NUM
FROM TABLE1
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Oct 21, 2010 5:13 pm
Reply with quote

no need to use a CASE statement, read about REPLACE
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Oct 21, 2010 5:14 pm
Reply with quote

So what have you found out about the syntax of the case statement? There should be plenty of examples lying around, too.

Have you then tried it yourself?
Back to top
View user's profile Send private message
arraiyan.parveen
Warnings : 1

New User


Joined: 10 Feb 2010
Posts: 5
Location: chennai

PostPosted: Thu Oct 21, 2010 5:15 pm
Reply with quote

The tech spec given to me states that i should use CASE statement to achieve this.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Oct 21, 2010 5:26 pm
Reply with quote

arraiyan.parveen wrote:
The tech spec given to me states that i should use CASE statement to achieve this.


Well, for heaven's sake, do not question the tech spec.

replace(replace(replace(col,' ','*'),x'00',' '),x'FF','*')

could possibly work.

but, wait for someone to provide you with a CASE statement
to satisfy your requirement,
thus avoiding the problem of telling the cretin, who wrote the specs,
that his db2 skill level approaches yours.
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Running a Job with the Default User ID JCL & VSAM 2
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
Search our Forums:

Back to Top