Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case Sensitivity Issue

Status
Not open for further replies.

damianp

Technical User
Aug 5, 2005
3
ZA
Hi there

The Applications we use (web-based) allow the users to enter data into tables that are a combination of upper and lower case.
This causes a problem when you have to start searching for data as it is case sensitive.
To mod all the application to convert the text to upper case before storing it in to the database is unviable.
Is there a way one can maybe do the conversion from a
database side (DB2) before records are inserted.
 
Several possibilities are come to mind:

You could use a trigger to force a conversion to upper case when the data us stored / modified.

An alternative would be to change the Searches to run against a view which defines the data as upper case (This could prevent the search using some indexes).

The database could hold both an 'as-entered' version and an UPPER version of the data, though this would be a big space waster.
 
Thanks BrianTyler,

The first seems to b the best option. Unfortunately we are working on an iSeries box (AS/400 v5r2) I am more familiar doing something like this in Oracle on UNIX. We also need to add a field to a table to be populated via trigger entering date/time in julian date format. Could you recommend any good tutorials/reading?
 
the advantage in the 3rd option of keeping an UPPER version of the data is that an index can be defined here as well and that supports search which is not case sensitive.

But triggers would definitely do the job. If you actually do not need the case sensitive data anymore, that is probaly what I would do.


Juliane
 
On DB2/UDB, the trigger would be a good option, but not on iSeries AS400. Triggers perform very slowly on the AS400, and are difficult to maintain unless you know RPG. As far as I can tell, the AS400 does not support SQL code in triggers.
 
You can define a logical file using DDS that uses a translation table to force case-insensitive searches. We use this in our customer master file and the data still shows up in mixed case, but is indexed without case sensitivity:
Code:
     A*ARCUS - CUSTOMER MASTER FILE                             
     A*                                                         
     A                                      ALTSEQ(*LIBL/ALTTBL)
     A          R CUS                       PFILE(ARCUS)        
     A*                                                         
     A          K CUSLNM                                        
     A          K CUSFNM                                        
     A          K CUSNO

The key is the ALTSEQ keyword.

We defined the ALTTBL table ourselves; but there are a bunch of tables out there in QSYS you could use (just pick the one that works with your code page).

Use the WRKTBL command to view them (and create a new one, if desired).

Me transmitte sursum, Caledoni!

 
Why don't you try the UPPER function ?
f.e. if MyField contains 'MySearch', the statement
Select ... Where UPPER(MyField) = 'MYSEARCH' (all caps)
will give the expected result.
 
damian,

If you're not overloaded on alternatives by now, on a z/os box, I believe we could accomplish this with the use of a fieldproc for a particular field(s) or an edit proc for the whole row.

Are they available to you on AS/400?

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top