Transformer Stage variable increment not working
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 11
- Joined: Sat Feb 10, 2007 12:32 am
Transformer Stage variable increment not working
Hi,
In DS Transformer stage , I use one stage variable STGVAR1 of IINTEGER with starting value 0.And then I use the expression that STGVAR1+1.The values in the output not coming correctly,output I pasted below.Can you help me the reason why it is not incrementing properly?
1
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
12
13
14
.
.
.
In DS Transformer stage , I use one stage variable STGVAR1 of IINTEGER with starting value 0.And then I use the expression that STGVAR1+1.The values in the output not coming correctly,output I pasted below.Can you help me the reason why it is not incrementing properly?
1
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
12
13
14
.
.
.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Transformer Stage variable increment not working
No, because both instances of your Transformer stage ARE incrementing correctly. You have two lots of 1 through 20. If you need to preserve the order thereof, add a sort of some kind downstream of the Transformer stage, and use a Sort Merge collection algorithm.Nagalakshmi.Krishna wrote:Can you help me the reason why it is not incrementing properly?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Typically you would use an algorithm such as the following in a transform stage to ensure that you get a single unique number across any number of partitions in your job:
Code: Select all
(@NUMPARTITIONS * ( @INROWNUM - 1)) + @PARTITIONNUM
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Please confirm whether the sequence number is not generating properly or Sorting order problem.
I checked this logic with "Round Robin Partition" and 4 node configuration file. The logic is working properly and explanation is as follows.
(((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1)
Partition 1:
((1 -1) * 4) + 0 +1 = 1
((2 -1) * 4) + 0 +1 = 5
((3 -1) * 4) + 0 +1 = 9
((4 -1) * 4) + 0 +1 = 13
Partition 2:
((1 -1) * 4) + 1 +1 = 2
((2 -1) * 4) + 1 +1 = 6
((3 -1) * 4) + 1 +1 = 10
((4 -1) * 4) + 1 +1 = 14
Partition 3:
((1 -1) * 4) + 2 +1 = 3
((2 -1) * 4) + 2 +1 = 7
((3 -1) * 4) + 2 +1 = 11
Partition 4:
((1 -1) * 4) + 3 +1 = 4
((2 -1) * 4) + 3 +1 = 8
((3 -1) * 4) + 3 +1 = 12
If you face Sorting order problem while collecting the records apply Sort Merge collection method on sequence number.
I checked this logic with "Round Robin Partition" and 4 node configuration file. The logic is working properly and explanation is as follows.
(((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1)
Partition 1:
((1 -1) * 4) + 0 +1 = 1
((2 -1) * 4) + 0 +1 = 5
((3 -1) * 4) + 0 +1 = 9
((4 -1) * 4) + 0 +1 = 13
Partition 2:
((1 -1) * 4) + 1 +1 = 2
((2 -1) * 4) + 1 +1 = 6
((3 -1) * 4) + 1 +1 = 10
((4 -1) * 4) + 1 +1 = 14
Partition 3:
((1 -1) * 4) + 2 +1 = 3
((2 -1) * 4) + 2 +1 = 7
((3 -1) * 4) + 2 +1 = 11
Partition 4:
((1 -1) * 4) + 3 +1 = 4
((2 -1) * 4) + 3 +1 = 8
((3 -1) * 4) + 3 +1 = 12
If you face Sorting order problem while collecting the records apply Sort Merge collection method on sequence number.
Cheers
Ravi K
Ravi K
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: