Variables...

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
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Variables...

Post by rasi »

Hi,

I want to know which is the best way to solve the following problem:

I want to get the max number from a sequence meta table and store in a variable. And then use the same value to a different stage variable.

thanks
rasi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SELECT MAX(columnname) FROM sequencemetatable;
Take the results of this query (for example from an ODBC stage) into a hashed file containing one row and two columns. The other column is the key column, and contains a constant value (let's call it "1"). Use a reference input link from this hashed file to load the stage variable in the first Transformer stage. The reference key expression is "1". (The returned value will be the same for every row processed, but that's what you want, presumably.) In fact, you may not even need a stage variable here, because the value is available from a reference input link column.
Derive an output column (called, say, MaxValue) from this stage variable or reference input link column, and use that column to load the stage variable in the second Transformer stage.
Post Reply