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!
Pattern Action File Coding Help
-
- Premium Member
- Posts: 10
- Joined: Thu Jul 09, 2015 7:10 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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:
^ 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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 10
- Joined: Thu Jul 09, 2015 7:10 am
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!
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!
-
- Premium Member
- Posts: 10
- Joined: Thu Jul 09, 2015 7:10 am