Changing case within pattern matching file.
Changing case within pattern matching file.
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
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
So you are saying this syntax can be used in the "Patterns file" of QualityStage?anbu wrote:Code: Select all
str="mcdonald" tgtStr=UpCase(str[1,1]) : str[2,1] : UpCase(str[3,1]) : str[4]
William Black
-
- Premium Member
- Posts: 425
- Joined: Sat Nov 19, 2005 9:26 am
- Location: New York City
- Contact:
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
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:Is there a certain syntax that can be used in the pattern file to do this?anbu wrote:Oops!! I didnt notice that requirement is for Quality Stage.
Above syntax is for transformer.
Julio Rodriguez
ETL Developer by choice
"Sure we have lots of reasons for being rude - But no excuses
ETL Developer by choice
"Sure we have lots of reasons for being rude - But no excuses
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.
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
Robert