Routines and Filters

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
DSmamta
Participant
Posts: 23
Joined: Mon Jul 12, 2004 12:53 pm

Routines and Filters

Post by DSmamta »

Hello All:

Need guidance and advice on a couple of things:

A. I have a routine that needs to be called from transformer. Went to the properties of transformer. There is Before / after routine. Need to select before sub-routine. Need help from here on how to call this routine. Or if there is a better way....?

QUESTION: Need help on how to call a routine in the transformer?


B. In transformer I have one input link (coming from a Message Queue) and multiple output link (going into one Seq file). In transformer created multiple columns. Each column represent a table. Each of these tables link in the transformer going into the sequential file. However, I want to set up constraints in transformer that will filter off "tables" that have no data.

QUESTION: How do I write a constraint in the transformer filtering out tables that have no data?

Would appreciate all your responses for the same at your earliest convience. Thanks in advance.

Regards,
MJ
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

The before/after routines are for doing something either before the first row enters the transformer or after the last row exits the transformer. If we understood what you're trying to do we could answer better. To call the routine simply write it in DS Manager, compile it, and it will appear on the drop-down list.

You can't have multiple output links going into the same sequential file. THIS DOESN'T WORK because a file is not a database. You will get a garbage file because both UNIX and DOS operating systems write files in blocks, not rows. THERE IS NO ROW CONCEPT in a sequential file, it's just characters. So, if you need multiple output links to collate use a LINK COLLECTOR, a hash file, or a table. If you have different output files specified in the link, then you are okay.

Your last question doesn't make any sense. If you have multiple output rows, and the input row has only one of those output paths to take, then you write a constraint expression that tests the condition for satisfying that output link. Without any more information we can't tell you how. My guess is that you have a code column that if type A then send to output link A, if type B then send to output link B, etc. So, your constraint is as simple as "inputlinkname.codecolumn = A" where you use the appropriate link and column names. This is all available in the training course, tutorials, manuals etc.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A before/after subroutine is called before or after a job or an active stage is run. To call one from a Transformer stage, right mouse click in the opened Transformer stage's background or click on the leftmost tool on the opened Transformer stage's toolbar. This will open the Transformer's stage properties dialog, in which you can set up the call to your before/after subroutine.

If you wanted to call this subroutine for every row processed, you have chosen the wrong routine type. Only transform functions are invoked from expressions within the Transformer stage. The only way you can call a before/after subroutine in this way is to create a transform function that is an interlude to it, and call that. You will need a DEFFUN declaration in the transform function.

Output link constraint expressions are entered in a grid which can be accessed by double clicking in the Constraints area, right mouse click in the background and choosing Constraints from the pop-up menu, or clicking the second-from-left tool in the opened Transformer stage's toolbar. Use the expression editor to enter the constraint expression, so that you avoid typing errors.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSmamta
Participant
Posts: 23
Joined: Mon Jul 12, 2004 12:53 pm

Thank you

Post by DSmamta »

Hello kcbland and ray.wurlod:

Thank you very much. Was able to right click on the derivation and call the routine successfully.

Still working on the filter in the transformer so as to filter out tables that have no rows.

Thank you once again.

Regards,
MJ
Post Reply