With conventional list form macros, you can use the macro forms
as follows:
- Use the list form of the macro, which expands to the parameter
list. Place the list form in the section of your program where you
keep non-executable data, such as program constants. Do not code it
in the instruction stream of your program.
- In the instruction stream, code a GETMAIN or a STORAGE macro to
obtain some virtual storage.
- Code a move character instruction that moves the parameter list
from its non-executable position in your program into the virtual
storage area that you obtained.
- For macros that have a modify form, you can code the modify form
of the macro to change the parameter list. Use the address parameter
of the modify form to reference the parameter list in the virtual
storage area that you obtained. Thus, the parameter list that you
change is the one in the virtual storage area obtained by the GETMAIN
or STORAGE macro.
- Invoke the macro by issuing the execute form of the macro. Use
the address parameter of the execute form to reference the parameter
list in the virtual storage area that you obtained.
With this technique, the parameter list is safe even if the first
task is interrupted and a second task intervenes. When the program
runs under the second task, it cannot access the parameter list in
the virtual storage of the first task.