check for data consistancy

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
raghunind
Participant
Posts: 2
Joined: Mon Jan 31, 2005 9:08 pm

check for data consistancy

Post by raghunind »

Hi,

I have a requirement to match a description field to be in title case. For example, this would be a valid description:"Removal of Motor". However, these would not be a valid description "removal of motor", or "REMOVAL OF MOTOR". We can take care of when each word needs to start with a capital letter, but how do we make sure that words like 'of, 'and' etc stay in lower case ? Also there may be some abbreviations in the text which strictly need to be in capital case like "Removal of Motor ISO". Any ideas on how I can do this ?

Thanks,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The usual solution to this is a custom Routine that uses a set of exception words, perhaps stored in a table (or hashed file). The following pseudo code explains the algorithm.

Code: Select all

Ans = ""
LOOP
   Get Next Word
UNTIL No Word Found
   Lookup Word In Exceptions
   IF (In Exceptions)
   THEN
      NewWord = Word
   ELSE
      NewWord = Oconv(Word, "MCT") ; * Title Case
   END IF
   Ans := " " : NewWord
REPEAT
Ans = Ans[2,Len(Ans)-1] ; * remove leading space
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply