usage of Common block across transformer

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

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

talk2shaanc wrote:Hey, craig i didnt get you. You mean to say it cannot be accomplished?
You got me. As others are pointing out, it cannot be accomplished. Transformer to transformer, yes - with the caveats about row buffering. Transformer to After-Job routine, no.
-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 »

The (server) job runs in one process. This executes a BASIC program called DSD.RUN. Variables opened into COMMON in a before-job subroutine are accessible - provided the same COMMON declaration exists - in an after-job subroutine for the same job.

A Transformer stage runs in a separate process. This executes a BASIC program called DSD.StageRun. Variables opened into COMMON in a before-stage subroutine are accessible in any routine invoked from that stage, including an after-stage subroutine.

Whether two Transformers execute in the same process or not depends on the job design. If they are directly connected by a link, and row buffering is not enabled, then they will run in the one process. This is the only case in which COMMON variables from the one might be accessible from the other Transformer stage.

However, I would never rely on this, because someone might change the design subsequently (inserting a stage between, or enabling row buffering).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Hi Guys,

If COMMON variables cannot be acessed across mutliple transformers (if row buffering is enabled or they belong to different processes) and cannot be accesed in an after job routine.
Transformer to transformer, yes - with the caveats about row buffering. Transformer to After-Job routine, no.
Could you guys please enlighten me on the exact scenarios in which the COMMON variables can be practically used in the datastage jobs?
Thanks,
Naveen
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Within the one Transformer stage you can invoke a before-stage subroutine that initializes variables, opens files, and so on. In any expression within the Transformer stage you can invoke Routines whose type is "transform function". Within the same Transformer stage you can invoke an after-stage subroutines. All these routines can communicate data (such as file handles) with each other by means of variables declared to be in COMMON areas of memory.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Thanks a lot for the clarification ray. :D
Thanks,
Naveen
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you need the value in a downstream stage, just create another column on the link(s) leading from this stage to that.

This is by far the most efficient mechanism for passing a value from one stage to another.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply