Hi Darren,
Can you please try the following:
1) Remove one set of BEGIN and END
2) Remove the DECLARE statement and shift the declaration of a integer after docTotal, above BEGIN.
Since the code is working for me, I am not sure if there are any limitations for SPS 05 regarding multiple Begin and End statements.
Regards,
Ravi