Sequence of Execution of Stage Variables,Constraints ...

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
MukundShastri
Premium Member
Premium Member
Posts: 103
Joined: Tue Oct 14, 2003 4:07 am

Sequence of Execution of Stage Variables,Constraints ...

Post by MukundShastri »

Can anybody tell about the sequence in which following are executed in a transformer of a datastage job :
1]Stage Variable
2] Constraints
3] Derivations

I am putting them in the sequence in which I feel they are executed. Can anybody confirm on this ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Without going into pages of detail...

1] Stage Variables
2] Derivations
3] Constraints

Stage variables are evaluated first, in the order listed. Constraints come last as they "constrain" which data rows go out which links, after all of the transform derivations have been applied.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a Transformer stage the following is the sequence of execution.

Code: Select all

1. Any before-stage subroutine is executed.  If ErrorCode is non-zero, the job aborts.
2. A row is obtained from the stream input link.
3. For each reference input link, in the specified execution order:
   (a) the reference key expression is evaluated
   (b) a "get by key" request is issued (this handles supply of NULL values if that record is not found
4. Stage variables are evaluated in the order in which they appear in their grid.
5. The REJECTED variable is set to TRUE
6. For each output link, in the specified execution order:
   (a) the output link constraint expression is evaluated
   (b) if the output link constraint expression is satisfied, column derivation expressions on that link are evaluated then a "put" request is issued and the REJECTED variable is set to FALSE
   (c) if the output link is marked as handling rejects, and the REJECTED variable is TRUE, column derivation expressions on that link are evaluated then a "put" request is issued 
7. If the row count reaches a particular value, the stage's status record in the RT_STATUSnn table for the job is updated
8. If the "end of data" token has not been received, go back to step 2.
9. Any after-stage subroutine is executed.  If ErrorCode is non-zero, the job aborts.
In particular, overruling Craig, output column derivations are only evaluated if that link's constraint expression is satisfied.
Examine the code in RT_BPnn to see all of this happening.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:In particular, overruling Craig, output column derivations are only evaluated if that link's constraint expression is satisfied.
Well... fooey. I guess even old dogs can learn something new. The darn thing is smarter than I thought. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
datastage
Participant
Posts: 229
Joined: Wed Oct 23, 2002 10:10 am
Location: Omaha

Precedence rules for name conflicts

Post by datastage »

This is similar (to an extent) to the question asked so I'll post this here for everyone's reference and hopefully it will stick in the minds of those that don't already have this memorized:

When there are name conflicts between different operands the following precedence is used:
1 Built-in functions (declared in DSParams)
2 DataStage macros
3 DataStage constants
4 DataStage functions
5 DataStage transforms
6 DataStage routines


Naturally it would be a best practice method to avoid reusing names for any of these entities so you don't need to worry about whether your function has precedence of your routine. Although it would be a cruel practical joke on a co-developer using some routines to create something with the same name and with higher precedence right in the middle of their unit testing, just to see how long it takes them to find out what's wrong. Buy none of us would actually pull a prank like that would we? :twisted:
Byron Paul
WARNING: DO NOT OPERATE DATASTAGE WITHOUT ADULT SUPERVISION.

"Strange things are afoot in the reject links" - from Bill & Ted's DataStage Adventure
Post Reply