How to write a routine

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
harithay
Participant
Posts: 106
Joined: Tue Dec 14, 2004 10:51 pm

How to write a routine

Post by harithay »

Hi All;

i have input file with follwing 4 fields

fund, date, TNA(AMOUNT), formtype

same fund name exists with differnt form types;

my requirement is to calculate change in TNA(AMOUNT) for the same fund name with days differnce between same funds is 360-370


there may exist same fund more than twice?

the formtypes are like this A, B, AT, BT----- original;
A/A, B/A, AT/A, BT/A----amending



In order to calculate the change in TNA(AMOUNT)for the same fund



xyz, 12/31/2003, 1200, A (A or B or AT or BT)

---------
-------
XYZ 12/31/2004, 1500, A/A (any form type)
xyz 12/31/2004, 1700 B (any form type)



i need to calculate change in TNA(AMOUNT) for the same fundname xyz


the out put should be like this

xyz 12/31/2003, 1200, A , 0
xyz 12/31/2004, 1500, A/A, 300
XYZ 12/31/2004, 1700 B, 500

Any suggestions

thanks in advance
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can sort the source to appear in order of history and use stage variables to achieve your desired result.

As your requirement appears to be incomplete at this moment, you can better decide the logic you wish to follow with the skeleton method mentioned above.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I have grave doubts that a Routine is what you want. From your - albeit incomplete - specification, I'd suggest an approach that sorts the input file then performs change detection via stage variables is more appropriate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
harithay
Participant
Posts: 106
Joined: Tue Dec 14, 2004 10:51 pm

Post by harithay »

hi ray, sainath


ray.wurlod wrote:I have grave doubts that a Routine is what you want. From your - albeit incomplete - specification, I'd suggest an approach that sorts the input file then performs change detection via stage variables is more appropriate.
thanks for ur suggetions. i got it

Best Regards
Post Reply