I did this in the '80s and it worked very well, I used it as a kind of
software interrupt in a communications handler that had to handle both
input and output at the same time from the same terminal. Unfortunately
I
don't rememver exactly how I did it, and I no longer have access to the
source code.
But I did find this in the HP Pascal for OpenVMS User manual, section
5.1.4
on page 5-6:
Asynchronous system trap routines (ASTs) and RMS completion routines
must
have both the ASYNCHRONOUS and UNBOUND attributes. Because they
are asynchronous, such routines can access only volatile variables,
predeclared
routines, and other asynchronous routines.
The Language Reference mentions the User manual near the end in
conjunction
with volatile variables.
You might also need to declare the variable p as volatile somewhere.
The User manual is here:
http://h71000.www7.hp.com/doc/82final/6140/aa-pxsnd-tk.pdf
You would probably want to read chapter 5 in there.
Hope this helps.
/Jonas