The usemylocalvariables statement reverses the action of the UseCallersLocalVariables statement, switching back to the current procedure’s normal local variables.


No parameters.


Any local variables created in a procedure can normally only be accessed in that procedure and not any other. In some special cases, however, it can be useful for a subroutine to access the local variables of the subroutine that called it. This is especially true when you are creating procedures for use as custom statements, and when using the execute statement.

Panorama has two statements that allow a procedure to access the local variables of the procedure that called the current procedure: UseCallersLocalVariables and UseMyLocalVariables. These statements are normally used as a pair. The UseCallersLocalVariables statement temporarily swaps out a subroutine’s current local variables with the local variables of the procedure that called the subroutine. The UseMyLocalVariables statement swaps the variables back again. While the variables are swapped the calling procedure has full access to the local variables of the subroutine. You can even create new local variables, which become local variables belonging to the calling procedure. Here is an example of a subroutine called * MakeAlphabet* that creates a local variable named alphabet and initializes it with 26 letters.

local alphabet

A procedure could call this subroutine as shown below.

call MakeAlphabet
message alphabet

The message statement will display ABCDEFGHIJKLMNOPQRSTUVWXYZ even though this local variable wasn’t created in the calling procedure.

Note: In this example we could have left off the final usemylocalvariables statement. Panorama will automatically switch the variables back when the end of the procedure is encountered, or when a return statement is executed.

See Also


10.0UpdatedCarried over from Panorama 6.0, but with improved handling. In previous versions of Panorama the UseCallersLocalVariables and UseMyLocalVariables statements did the same thing -- swap local variables with the calling procedure. Now Panorama actually keeps track of which set of local variables are in use, instead of just swapping. So if you use this statement twice in a row, you'll still be using the procedure's local variables (in previous versions this would have switched you back to the calling procedure's normal local variables). Also, Panorama now allows you to omit the closing UseMyLocalVariables. You can simply return from the procedure at any time and Panorama will take care of fixing up local variable usage.