Pattern Action File Coding Help

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
QualityStageatGM
Premium Member
Premium Member
Posts: 10
Joined: Thu Jul 09, 2015 7:10 am

Pattern Action File Coding Help

Post by QualityStageatGM »

Hello,

I've been trying to do some work with the Pattern Action File for Rulesets and have been looking at the IBM knowledge center site here,

http://www-01.ibm.com/support/knowledge ... alues.html

but am running into problems successfully running a job with a ruleset with a conditional pattern specification.

For example, suppose I have a pattern that DataStage recognizes as this

A|B|?|^|G|G|F|D|E|> where A, B, D, E, F, and G are all classes that I've specificed, suppose for values of "?" where "?" equals a specific value like "metal chassis", I wanted to output a specific value in one of my output columns, how would I edit this command for it to work correctly?

A|B|?|^|G|G|F|D|E|>
*?|^= "metal chassis"
Copy "specialpattern" {OutputColumn}

where OutputColumn is just a column I defined in the Dictionary File.

Is there a default ruleset that I can use as a template or some editing to the above command that I can do for the ruleset to do this task?

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

Post by ray.wurlod »

Does what you've done throw an error, or merely an incorrect result?
^ is a numeric token, so would never match any part of "metal chassis". Try this pattern/action instead:

Code: Select all

A|B|? [ {} = "metal chassis" ]|^|**
COPY "specialpattern" {OutputColumn}
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post by boxtoby »

Try this:

* ?="metal chassis"
COPY_A [1] {OutputColumn}

or if you want to be more specific:

A|B|?|^
COPY_A [3] {OutputColumn}

COPY_A will copy tokens containing a space

If you want to clear the value of the token afterwards add RETYPE [x] 0

Hope this helps.

Bob.
Bob Oxtoby
QualityStageatGM
Premium Member
Premium Member
Posts: 10
Joined: Thu Jul 09, 2015 7:10 am

Post by QualityStageatGM »

It originally did throw an error. The messages are:

Standardize_2,0: Pattern lines and actions sets out of synch, or command misspelled
Standardize_2,0: The syntax error above was found on line 76 of the pattern-action file ./RT_QS2264/V0S2/Controls/Testing.PAT as follows:
Copy "specialpattern" {OutputColumn}


From the suggestions, I got the following code to work

A|B|? [ {} = "metalchassis" ]|^|**
COPY "specialpattern" {OutputColumn}

It looks like there can't be a space between metal and chassis.

Bob, I'm still investigating the code you provided and trying to combine it with the searching done with Ray's code.

Thanks!
QualityStageatGM
Premium Member
Premium Member
Posts: 10
Joined: Thu Jul 09, 2015 7:10 am

Post by QualityStageatGM »

Thanks everyone,

A|B|? [ {} = "metalchassis" ]|^|**
COPY_A [1] {OutputColumn}

The above code works also and standardizes the value of A.
Post Reply