Break in the sequence numbers

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
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Break in the sequence numbers

Post by prasad v »

Hi

I am generating the sequence numbers by using below code:
@PARTITIONNUM + (@NUMPARTITIONS * (@INROWNUM - 1)) + 1
It is not giving the exacttly

Eg:

3
4
5
6
7
8
9
10
12
13


Here 11 is missing, i am using Round robin partition method. Can any body suggest me what needs to be used in this case?

Thanks in advancee[/quote]
vinothkumar
Participant
Posts: 342
Joined: Tue Nov 04, 2008 10:38 am
Location: Chennai, India

Post by vinothkumar »

Try this code

( (@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

I could not find any difference in both of these codes.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Does your Transformer stage include any constraint expressions? Use Monitor to verify that all nodes processed the same number of rows.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

There is no Constraints expressions in Transformer.

As i mentioned, i used Round Robin method. i think it makes the same no.of records as per the incoming count.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

About the only way to guarantee you have no gaps in a sequence number assignment using a formulaic method like this is to run the stage in sequential mode. Even though Round Robin partitioning gives you as-close-to-possible even distribution among the partitions, that's only possible when the number of records is evenly divisible by the number of partitions and how often does that occur naturally in parallel data processing?

Surrogate Key Generator stage using a static file with a block size of 1 would work in a parallel environment, but that blocksize will create a major bottleneck to processing (I've seen it done). I would prefer running a sequential stage rather than SKG with a blocksize of 1. A database sequence MIGHT give better performance but I haven't tried it.

The question to ask is: Must you absolutely have no gaps in the assigned sequence number? If so, and you're reading from a sequential file (and not in parallel), you could assign record numbers in the sequential file stage.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
suresh.angadi
Participant
Posts: 17
Joined: Tue Jun 23, 2009 6:44 pm

Re: Break in the sequence numbers

Post by suresh.angadi »

Hi Prasad,

@PARTITIONNUM + (@NUMPARTITIONS * (@INROWNUM - 1)) + 1
((@INROWNUM - 1) * @NUMPARTITIONS + @PARTITIONNUM + 1)

both the formula for getting seq no works fine, i think some logic problem in your job.

can you explain what is your datastage job logic.

Regards
Suresh
Suresh Angadi
Post Reply