Using CALL, BALR, BASR, or BASSM

When a module is reenterable, you can save time by passing control to a load module without using the control program. Pass control without using the control program as follows.
Note:
  1. You must use a branch and save and set mode instruction (or the CALL macro with the LINKINST=BASSM parameter specified) if passing control to a module in a different addressing mode.
  2. When control is passed to a load module without using the control program, you must check the load module attributes and current status of the copy yourself, and you must check the status in all succeeding uses of that load module during the job step, even when the control program is used to pass control.

The reason you have to keep track of the usability of the load module has been discussed previously; you are not allowing the control program to determine whether you can use a particular copy of the load module. The following paragraphs discuss your responsibilities when using load modules with various attributes. You must always know what the reusability attribute of the load module is. If you do not know, you should not attempt to pass control yourself.

If the load module is reenterable, one copy of the load module is all that is ever required for a job step. You do not have to determine the status of the copy; it can always be used. You can pass control by using a CALL macro, a branch, a branch and link instruction, a branch and save instruction, or a branch and save and set mode instruction (BASSM). Use BASSM (or the CALL macro with the LINKINST=BASSM parameter specified) only if there is to be an addressing mode switch.

If the load module is serially reusable, one use of the copy must be completed before the next use begins. If your job step consists of only one task, make sure that the logic of your program does not require a second use of the same load module before completion of the first use. This prevents simultaneous use of the same copy. An exit routine must not require the use of a serially reusable load module also required in the main program.

Preventing simultaneous use of the same copy when you have more than one task in the job step requires more effort on your part. You must still be sure that the logic of the program for each task does not require a second use of the same load module before completion of the first use. You must also be sure that no more than one task requires the use of the same copy of the load module at one time. You can use the ENQ macro for this purpose. Properly used, the ENQ macro prevents the use of a serially reusable resource, in this case a load module, by more than one task at a time. For information on the ENQ macro, see Resource control You can also use a conditional ENQ macro to check for simultaneous use of a serially reusable resource within one task.

If the load module is non-reusable, each copy can only be used once; you must be sure that you use a new copy each time you require the load module. You can ensure that you always get a new copy by using a LINK macro or by doing the following:
  1. Issue a LOAD macro before you pass control.
  2. Pass control using a branch, branch and link, branch and save, branch and save and set mode instruction, or a CALL macro.
  3. Issue a DELETE macro as soon as you are through with the copy.