Initcaps

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ankita
Participant
Posts: 57
Joined: Sun Nov 13, 2005 11:17 pm

Initcaps

Post by ankita »

Hi All,
There is a requirement to change the first char of every word into Uppercase. Say i/p test is : willilam smith

O/p should be : William Smith

No. of words in the input string may vary. Is there any easy way to do this ? other than extracting first char of each word separately ? Please suggest.

Thanks,
Ankita
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

Post by Nripendra Chand »

when no of words dynamic then you can write a parallel routine and pass input column and no of words as two arguments to it.
-Nripendra Chand
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There is no builtin function in PX to do this. If you can write this portion of your processing in Server, then you can use the function OCONV(In.Column,"MCN") to perform this conversion for you.
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

Post by Nripendra Chand »

one more option.. u can use Basic transformer and use CAPITALS fn to do this as follows:
CAPITALS(%Arg1%)

but again it's a BASIC transformer being used in a PX job..
Last edited by Nripendra Chand on Thu Mar 20, 2008 4:41 am, edited 1 time in total.
-Nripendra Chand
ankita
Participant
Posts: 57
Joined: Sun Nov 13, 2005 11:17 pm

Post by ankita »

Thanks for your suggestions ! I will try with basic transformer .
Ankita
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I just realized I mis-typed the function, the correct one is "OCONV(In.ColumnName,"MCT")
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ps. CAPITALS and Arnd's specific OConv function call are the same thing, as the CAPITALS transform just does the function call for you. Without any mis-typing. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply