Sequence Number

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
umamahes
Premium Member
Premium Member
Posts: 110
Joined: Tue Jul 04, 2006 9:08 pm

Sequence Number

Post by umamahes »

I need to generate a sequence number.we have any option like KeymgmtGetNextvalue in parallel jobs.Surrogate key generator stage is not suitable for my requirement.

Thanks
uma
HI
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Why doesn't the surrogate key generation work for you? The answer to that might help in finding a something that you can use.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Stop thinking like a server job developer. Give some thought to how you might construct a sequence that is unique over all partitions, apart from the simple-minded approach of sequential execution of the generator. Hint: you will need to include the partition number and partition count in your calculations. You may, when you Search in the forum, discover that other people have already solved this, both with and without a Surrogate Key Generator stage. There is no SDK for parallel jobs, but there is nothing to stop you creating your own parallel routine. Just beware that the same parallelism restrictions will apply in your routine as well.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Vincent has an FAQ entry on the same.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

How about this:
Put an external filter stage and use UNIX command cat -n
(Propagate a column from the previous stage for this with blank probably - varchar of the size you want)
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Only if you ensure that the External Source stage executes in sequential mode. Otherwise you'll get a separate sequence of numbers starting from 1 on each processing node.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Post by nick.bond »

I would go with vincent's FAQ solution. No point mkaing forcing data into sequential mode just to get a sequence number.
Regards,

Nick.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

nick.bond wrote:I would go with vincent's FAQ solution. No point mkaing forcing data into sequential mode just to get a sequence number.
"No point" ?? Definitly you earned some points for the above post ;)

In this case External filter execute on sequential mode even if you specify as parallel. If you see the dump score report you can see that.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Wrong. You can change execution mode to parallel on the Advanced tab of the stage properties. Indeed (at version 7.5.1A) the default execution mode for an External Source stage is parallel. The same is true of the External Filter stage, but I'm not sure how this crept into the discussion.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

I did some testing on this! I specified explicitly 'parallel' in the external filter stage. Checked the dump score report in the director. External filter ran on single node where as other 2 stages ran parallely on multiple nodes. Apparently the name of the external filter itself is showing as sequential external filter in the score report.

This is the job

Row generator (parallel mode) --> External filter (parallel mode) --> Peek
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Post Reply