Page 1 of 1

How to write a routine

Posted: Wed Jun 01, 2005 11:34 pm
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

Posted: Thu Jun 02, 2005 4:32 am
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.

Posted: Thu Jun 02, 2005 5:29 am
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.

Posted: Thu Jun 02, 2005 11:47 am
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