Is there an equivalent of the datastage function DCount in QualityStage.
What I am trying to do is standardize a file and then look for the number of occurrence of a particular classification.
eg : F+W+IWF+CFF
My answer should be 4, Since I am looking for all "F" in the pattern.
I am trying to avoid putting in a DS job if I can
Thanks
Ejaz
QualityStage equivalent of DCount function
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
Hi ejazsalim,
Off the top of my head, I don't believe the 'function' you're looking for is available in QualityStage Pattern Action Language, however you could build a set of patterns to look for hard-coded numbers of tokens:
E.g. Given an output field CN (count) defined in your dictionary ...
You'd obviously need to add the logic to prevent double-matching of patterns, but I'm sure you see what I'm getting at. Very far from an elegant solution, but would work within certain limits.
A better solution would be to use an Investigate stage, then push the .PAT file through a shell script (by defining a Program Stage) which would return the number of instances of your required token on each line.
... but it would still be far easier to use DataStage for all this. Any particular reason why you're avoiding doing this in DS?
HTH,
J.
Off the top of my head, I don't believe the 'function' you're looking for is available in QualityStage Pattern Action Language, however you could build a set of patterns to look for hard-coded numbers of tokens:
E.g. Given an output field CN (count) defined in your dictionary ...
Code: Select all
** | F | **
COPY "1" {CN}
** | F | ** | F | **
COPY "2" {CN}
** | F | ** | F | ** | F | **
COPY "3" {CN}
** | F | ** | F | ** | F | ** | F | **
COPY "4" {CN}
etc.
A better solution would be to use an Investigate stage, then push the .PAT file through a shell script (by defining a Program Stage) which would return the number of instances of your required token on each line.
... but it would still be far easier to use DataStage for all this. Any particular reason why you're avoiding doing this in DS?
HTH,
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Thanks J
well the only reason to avoid DS is that I am trying to build a lightweight solution using only QS as this is supposed to run on individual laptops for users with minimum training. I am just trying to avoid training my business folks on 2 tools
well the only reason to avoid DS is that I am trying to build a lightweight solution using only QS as this is supposed to run on individual laptops for users with minimum training. I am just trying to avoid training my business folks on 2 tools
jhmckeever wrote:Hi ejazsalim,
Off the top of my head, I don't believe the 'function' you're looking for is available in QualityStage Pattern Action Language, however you could build a set of patterns to look for hard-coded numbers of tokens:
E.g. Given an output field CN (count) defined in your dictionary ...You'd obviously need to add the logic to prevent double-matching of patterns, but I'm sure you see what I'm getting at. Very far from an elegant solution, but would work within certain limits.Code: Select all
** | F | ** COPY "1" {CN} ** | F | ** | F | ** COPY "2" {CN} ** | F | ** | F | ** | F | ** COPY "3" {CN} ** | F | ** | F | ** | F | ** | F | ** COPY "4" {CN} etc.
A better solution would be to use an Investigate stage, then push the .PAT file through a shell script (by defining a Program Stage) which would return the number of instances of your required token on each line.
... but it would still be far easier to use DataStage for all this. Any particular reason why you're avoiding doing this in DS?
HTH,
J.
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
Hi ejazsalim,
I'll leave it to others to discuss the merits of stand alone DataStage on a laptop. Assuming those laptops are connected to your network then remember that as well as embedding a QualityStage job inside DataStage, you could also (in theory - although I've never tried it) invoke a DataStage job from within QualityStage by defining a Program Stage around the 'dsjob' command. This wouldn't require your users to know very much about DataStage as the interaction would be effectively hidden. DataStage would just operate on the QualityStage output and produce one or more sequential files just like any other QualityStage stage.
As noted above, my first approach would be an Investigate stage with the resulting PAT file pushed through something like an awk script.
HTH,
John.
I'll leave it to others to discuss the merits of stand alone DataStage on a laptop. Assuming those laptops are connected to your network then remember that as well as embedding a QualityStage job inside DataStage, you could also (in theory - although I've never tried it) invoke a DataStage job from within QualityStage by defining a Program Stage around the 'dsjob' command. This wouldn't require your users to know very much about DataStage as the interaction would be effectively hidden. DataStage would just operate on the QualityStage output and produce one or more sequential files just like any other QualityStage stage.
As noted above, my first approach would be an Investigate stage with the resulting PAT file pushed through something like an awk script.
HTH,
John.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
... and I assumed every right-minded individual had MKS/Cygwin installed!?
... either that or you really enjoy pushing data through VBScript/WScript.
... either that or you really enjoy pushing data through VBScript/WScript.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>