Changing case within pattern matching file.

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Changing case within pattern matching file.

Post by wblack »

Is there a way to change the case of a particular character in a string. For Example if I have 'mcdonald' as the string and I want to change it to 'McDonald'.
William Black
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

str="mcdonald"
tgtStr=UpCase(str[1,1]) : str[2,1] : UpCase(str[3,1]) : str[4]
You are the creator of your destiny - Swami Vivekananda
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Post by wblack »

anbu wrote:

Code: Select all

str="mcdonald"
tgtStr=UpCase(str[1,1]) : str[2,1] : UpCase(str[3,1]) : str[4]
So you are saying this syntax can be used in the "Patterns file" of QualityStage?
William Black
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Oops!! I didnt notice that requirement is for Quality Stage.

Above syntax is for transformer.
You are the creator of your destiny - Swami Vivekananda
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Post by wblack »

anbu wrote:Oops!! I didnt notice that requirement is for Quality Stage.

Above syntax is for transformer.
Is there a certain syntax that can be used in the pattern file to do this?
William Black
JRodriguez
Premium Member
Premium Member
Posts: 425
Joined: Sat Nov 19, 2005 9:26 am
Location: New York City
Contact:

Post by JRodriguez »

Mr. Black,

Anbu's solution works like a charm for you. At version 8.x you have most of the Datastage stages available for Quality stage jobs. Just insert a transformer stage between the source and the standardization stage in your QS job as per below flow.

Source ---> Transformer ---> Std----> Output

Add Anbu's solution in the transformer and set the STD stage to keep the cases

From within the pattern action file this might work

COPY_A [1](1:1) { XX} This will get the initial from the CLS file or the
standardized version of your input string
CONCAT [1](2:-1) {XX} This will get the rest of the string from the raw
data and concatenated to the dictionary field




wblack wrote:
anbu wrote:Oops!! I didnt notice that requirement is for Quality Stage.

Above syntax is for transformer.
Is there a certain syntax that can be used in the pattern file to do this?
Julio Rodriguez
ETL Developer by choice

"Sure we have lots of reasons for being rude - But no excuses
rjdickson
Participant
Posts: 378
Joined: Mon Jun 16, 2003 5:28 am
Location: Chicago, USA
Contact:

Post by rjdickson »

Hi,

Acutally, I believe everything within the rule set is considerd upper case, and that is not changeable in the Pattern Action Language. You can put mixed case in the CLS, but it will be output as upper case.

The only way you can have mixed case is via the 'Default Standardization Output Format' at the stage level, so it applies for all rulesets used.

In your example, 'McDonald' will be 'Mcdonald' when you select 'Capatalize Every word', and there is nothing in the Standardize Stage that will fix that. As noted in the post, you can use a Transformer AFTER the Standardize stage to obtain your desired results.
Regards,
Robert
Post Reply