Running Apache under OS/400 V5R2.

I use SSI at present to retrieve dates and server variables but I would like
to have a couple of web pages execute a small program whenever they are
accessed. Looking at the SSI documentation I should be able to do this but
everytime I load the page I get an error:

[an error occurred while processing this directive]
I can't see anything in the logs that indicates a problem. Can anyone help
me with how I might use the exec SSI function?Thanks