Logic Implementation in Transfomer

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
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Logic Implementation in Transfomer

Post by ksv2584 »

Hi

I need create a batch id(001,002,003) for each transaction type (1234,459,3657).I have impelmented this in transformer by incrementing the batch id for change in transaction type


Since my job in running on 2 nodes iam getting duplicate batch id's,when runed in Sequential mode it is fine

Please let me know any other way to implement instead of running the transformer in sequentail mode

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

Post by ray.wurlod »

Partition your data properly using a key-based algorithm on transaction type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
MT
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 09, 2007 3:51 am

Re: Logic Implementation in Transfomer

Post by MT »

Hi Vidya,

you could use the different partitions for your batch id calculation.

You could do it by having two stage variables
- a simple counter (counter = counter + 1)
- batch_id = @PARTITIONNUM + counter*@NUMPARTITIONS

Additionally you have to follow Rays advise in order to have all identical transaction types in a single partition.

best regards
Michael
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Logic Implementation in Transfomer

Post by ksv2584 »

Hi

Though i have partioned (HASH) with transaction type ,iam geting duplicate batch id 's in parallel mode

ex: Partition1 batchid partiotion2 batchid
100 1 200 1
100 1 300 2
400 2 500 3


please sugeeat Some other solution ???
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Post by ksv2584 »

hi

One more requirement to this sam tansaction type should have sam batch id ..


Even the second by MT did nor work ..
MT
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 09, 2007 3:51 am

Post by MT »

Hi,
ksv2584 wrote:hi

One more requirement to this sam tansaction type should have sam batch id ..


Even the second by MT did nor work ..
well you should not expect a fully programmed syntax and solution - you have to add some more thoughts by your own.
The input should be sorted by transaction type.
You have to detect changes in your transaction type (via Sort stage or with the right logic in the transformer) and the you chnage the counter only when the transaction type changed.

Please test my solution again an print the
@PARTITIONNUM
counter
@NUMPARTITIONS
separately in the output to check what is going wrong.


regards
Michael
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Or use the below one.

(((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1)
Cheers
Ravi K
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Post by ksv2584 »

Thnaks all .. I applied my logic and its working fn ..
Post Reply