I was using the GenerateGUID function in PowerScript the other day (and it's been quite a while since I last used it). I thought the example given in the online help was in error, because it showed the REF keyword being used in the actual use of the function.
Turns out the example is correct. In fact, as the PowerBuilder documentation indicates, the REF keyword is required in the actual call when working with an OLE Server application that attempts to return values in arguments. The following is a copy of the relevent section of the HTML books. How odd to consider how long I've been working with PB and OLE that I just noticed this.
Or perhaps its a symptom of something else. They say one of the best things about getting older is you get to meet all these nice new friendly people over and over again...
Passing arguments by reference
If an OLE server expects an argument to be passed by reference so that it can pass a value back to your script, include the keyword REF just before the argument. This is similar to the use of REF in an external function declaration:
olecontrol.Object.functionname ( REF argname )
In these generic examples, the server can change the values of ls_string and li_return because they are passed by reference:
ole_1.Object.testfunc(REF ls_string, REF li_return)
This example illustrates the same function call using an OLEObject variable.
ole_obj = CREATE OLEObject
ole_obj.testfunc(REF ls_string, REF li_return)