Using the same Sequence in multiple tables

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Using the same Sequence in multiple tables

Post by yaminids »

Hello there,

Can I use the sequence generated by 'KeyMgtNextValue' in table A to be the sequence in table B. My intension is to use same sequence in both the tables.. If so, can anyone explain to me how to achieve this.

Thanks in advance.
-Yamini
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

KeyMgtNextValue is a BASIC routine. There have been recent posts here about using BASIC Transformer stage in parallel jobs; the same may apply to BASIC routines.

That said, KeyMgtNextValue and KeyMgtNextValueConcurrent do not have any link to anything except the argument value supplied. They can be used to generated as many independent sequences as you can dream up names for. The sequence's next value is stored in a hashed file called SDKSequences, where the key is the sequence name.

If you want the same sequence to be shared between two tables, then do it. What it means is that the two tables (if they began empty and are not updated by any other means) will have entirely disjoint sets of generated values.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Using the same Sequence in multiple tables

Post by yaminids »

Hello Ray,

Thank you for your reply. I am, as part of the project, trying to have same sequence in both the tables i.e both the columns in the two tables must have same values when we compare row-by-row.
Can you help me in achieving this with DataStage please.

Thanks in advance.
-Yamini
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Generate the next value into a stage variable using the KeyMgtGetNextValue function.

Use that stage variable as the derivation for the output column on both output links (one to each table).

Stage variables are evaluated once per input row.
Column derivations are evaluated once per output row per output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Alternitavely if the jobs for each table are in seperate jobs then you can always store the MAX value in the Global Variable ( Read this post: viewtopic.php?t=86986&highlight=user+global ).
Cheers,
Dave Nemirovsky
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Using the same Sequence in multiple tables

Post by yaminids »

Thank you Ray.

-Yamini
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Using the same Sequence in multiple tables

Post by yaminids »

Thank you David,

-Yamini
Post Reply