Compare Next Value before insert into target

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jhaggas
Participant
Posts: 5
Joined: Thu Sep 27, 2007 2:22 pm

Compare Next Value before insert into target

Post by jhaggas »

Is there anyway to compare the next value in a transformer before doing a insert?

I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.

Your thoughts or ideas would be appreciated. Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not directly. There's no lookahead capability within the flow in DataStage.

You can use stage variables in a Transformer stage to detect the first record in a group, then sort by the group keys then by that value in descending order, and then detect when that"key change column" was 1 in the previous row in a downstream Transformer. In that case you are at the last record in the group, so you could use the value to constrain the output.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sanath1234
Participant
Posts: 24
Joined: Wed Oct 17, 2007 1:28 am
Location: hyderabad

Re: Compare Next Value before insert into target

Post by sanath1234 »

jhaggas wrote:Is there anyway to compare the next value in a transformer before doing a insert?

I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.

Your thoughts or ideas would be appreciated. Thanks.
by useing stage variables in transformer ucan do it in stage variables u have to store the curr_next_val which u generated by key mgt tramsform.
ETL=DS
deepthi
Participant
Posts: 56
Joined: Thu Apr 28, 2005 9:52 am

Re: Compare Next Value before insert into target

Post by deepthi »

What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?

Thanks
Deepthi

sanath1234 wrote:
jhaggas wrote:Is there anyway to compare the next value in a transformer before doing a insert?

I am sorting data by three columns and comparing the previous values of each row to perform various summary activites, but need a way to tell the transformer only to insert the last one. If I had a way to compare the next value with the current value I could do it that way or if there is a way to know when I get the last value for a sort key row I could only insert the last one.

Your thoughts or ideas would be appreciated. Thanks.
by useing stage variables in transformer ucan do it in stage variables u have to store the curr_next_val which u generated by key mgt tramsform.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Compare Next Value before insert into target

Post by ray.wurlod »

deepthi wrote:What is the maxium value that this key_mgt transform generates upto?
Will it resets after the number is reached?

Thanks
Deepthi
No practical limit, and it does not reset. The engineering limit depends on the precision setting, but you can always get at least a fifteen digit number.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply