Hi,
How can we Set the Stage Variable at the transformer level so that it can used for the validation for the next incoming row
Stage Variables:A,Status
first row set A =10
second row IF (A =10) Do Something ..
then set Status =' OK'
Is there any Set function in Basic ?
Set the Stage Variable at the Transformer Level
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 94
- Joined: Wed May 08, 2002 8:44 am
- Location: Germany
- Contact:
Hello Sairam,
for stage variables you can set derivations in the same way you do it for other derivations on your link output data. So you simply set something like IF INCOM.ROWA = 10 Then 'OK' Else 'NOK'. Since DataStage operates simply sequentially, and stage variables keep their values until being overwritten, you can compare an incoming row value against a value in a stage variable still being there from the last row and not being overwritten yet in the sequence of operation.
Klaus
for stage variables you can set derivations in the same way you do it for other derivations on your link output data. So you simply set something like IF INCOM.ROWA = 10 Then 'OK' Else 'NOK'. Since DataStage operates simply sequentially, and stage variables keep their values until being overwritten, you can compare an incoming row value against a value in a stage variable still being there from the last row and not being overwritten yet in the sequence of operation.
Klaus
Or if you really need to know abt Stage Variables, which I assume you are trying to learn. Then,
in the Transformer -> Properties, the first Button on the top menu left to Constraints is the 'Stage Properties' window and in that option you can define Stage variables and give them the default value also.
in the Transformer -> Properties, the first Button on the top menu left to Constraints is the 'Stage Properties' window and in that option you can define Stage variables and give them the default value also.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
When you're assigning values anywhere in DataStage GUI, such as initializing or modifying stage variables, you are using an expression, not a statement.
Therefore there's no requirement for Set (btw there is no Set in DataStage BASIC, though there is a Let).
All you need is an expression that returns the value required.
To accomplish what you ask there's a trick, where you use two stage variables. Stage variable expressions are executed after all input links and before any output links. They are executed in the order in which they are specified.
You need two stage variables as follows.
Example
In this example the value of the stage variable varRequiredValue is "is different" if inlink.colname is different in this row than in the previous row, or is "is the same" if inlink.colname is the same in this row as in the previous row. The additional constraint for row 1 obviates the need to initialize the stage variable to the value in the first row.
Therefore there's no requirement for Set (btw there is no Set in DataStage BASIC, though there is a Let).
All you need is an expression that returns the value required.
To accomplish what you ask there's a trick, where you use two stage variables. Stage variable expressions are executed after all input links and before any output links. They are executed in the order in which they are specified.
You need two stage variables as follows.
- varRequiredValue
varPreviousValue
Example
Code: Select all
varRequiredValue:
If inlink.colname <> varPreviousValue And @INROWNUM <> 1 Then "is different" Else "is the same"
varPreviousValue:
inlink.colname
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.
Hi Ray,
Thanks a lot Ray but I need u r suggestion ,I have designed a job where in I need to pass the Header Information ,Trailer Information and The Detail info , for more validations , to an other job but How can I pass it
a)Thru Job Parameters
b)Write to a file and then call that file on the next job (read I/o DIsk operation)
c) Thru Shared Containers.
Please suggest the best Optimal way
IS IT POSSIBLE TO SET THE JOB PARAMS VALUE AT TRANSFORMER .
Thanks in advance
Sairam
Thanks a lot Ray but I need u r suggestion ,I have designed a job where in I need to pass the Header Information ,Trailer Information and The Detail info , for more validations , to an other job but How can I pass it
a)Thru Job Parameters
b)Write to a file and then call that file on the next job (read I/o DIsk operation)
c) Thru Shared Containers.
Please suggest the best Optimal way
IS IT POSSIBLE TO SET THE JOB PARAMS VALUE AT TRANSFORMER .
Thanks in advance
Sairam
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That's a different question.Sairam wrote:Hi Ray,
Thanks a lot Ray but I need u r suggestion ,I have designed a job where in I need to pass the Header Information ,Trailer Information and The Detail info , for more validations , to an other job but How can I pass it
a)Thru Job Parameters
b)Write to a file and then call that file on the next job (read I/o DIsk operation)
c) Thru Shared Containers.
Please suggest the best Optimal way
IS IT POSSIBLE TO SET THE JOB PARAMS VALUE AT TRANSFORMER .
Thanks in advance
Sairam
You can update stage variables in a Transformer stage.
You can not, ever, anywhere, update a job parameter once its job has started.
How much information has to be parked? You can certainly use a DataStage job to split into header, trailer and detail records. If you want to park them, use three separate sequential files (they're fastest). Or you could do all the processing in three streams in the job that splits them, without using separate jobs.
Shared containers will not be of any value unless the processing, metadata and other non-parameterizable information is identical.
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.