USING RULES Need help Overiding and stripping

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
kommven
Charter Member
Charter Member
Posts: 125
Joined: Mon Jul 12, 2004 12:37 pm

USING RULES Need help Overiding and stripping

Post by kommven »

I am using QS.
I have a URGENT requirements to strip of all the characters after ':' and ';' including.
Any gurus to guide me...
thanks in advance
Kewl,
kommven
Charter Member
Charter Member
Posts: 125
Joined: Mon Jul 12, 2004 12:37 pm

Post by kommven »

No reply till now/...

Well I came up with a new requirement.
I need to strip away everything in parenthesis
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no such thing as URGENT here.

If you have DataStage it's very easy to pre-process your data. It's more tedious to do using QualityStage stages, but in general it's possible.

Do you have DataStage?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kommven
Charter Member
Charter Member
Posts: 125
Joined: Mon Jul 12, 2004 12:37 pm

Post by kommven »

Yes I can use DataStage whats the function that I can use?
JamasE
Participant
Posts: 32
Joined: Sun Aug 31, 2003 5:52 pm

Re: USING RULES Need help Overiding and stripping

Post by JamasE »

kommven wrote:I have a URGENT requirements to strip of all the characters after ':' and ';' including.
Probably a lot easier in DS, but if you must use QS: Firstly, have ':' and ';' in your sep, but not strip lists.

Then a rule like

Code: Select all

:|**|$
RETYPE [1] 0
RETYPE [2] 0

;|**|$
RETYPE [1] 0
RETYPE [2] 0

**
COPY [1] {OP}
where OP is the variable reference where the output string will be stored.

(Note: Haven't pattern coded for a while, but I think this will work.)

Cheers,
Jamas
JamasE
Participant
Posts: 32
Joined: Sun Aug 31, 2003 5:52 pm

Post by JamasE »

kommven wrote:I need to strip away everything in parenthesis
Again, probably easier outside QS, but...

Code: Select all

\(|**|\)
RETYPE [1] 0
RETYPE [2] 0
RETYPE [3] 0
And then either spit out the string or process elsewhere... (same warning as before re: coding)

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

Post by ray.wurlod »

For removing everything between parentheses, and assuming there is only one set of parentheses, you can use an expression. If there is more than one set of parentheses, you need a routine that iteratively processes the string using the same logic for each set.
Extract everything up to and including the left parenthesis, then concatenate everything from and including the right parenthesis. You could use the field function, but Index() and Substring operations may be clearer. The following expression might appear in a server job Transformer stage.

Code: Select all

Left(TheString,Index(TheString, "(", 1)) : Right(TheString, Len(TheString)-Index(TheString, ")", 1) + 1)
Later in the same job, use a QualityStage stage in the DataStage job to invoke your other QualityStage processing job.

To strip all the characters following ":" or ";" similar expressions are used, for example

Code: Select all

Left(TheString, Index(TheString, ":", 1))
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