bdfs1m15Structured Programming Macros

#SUBR Macro Group

Use this macro group to call common subroutines. Generally, subroutines:

The #SUBR macro group includes the following macros:

See #SUBR Macro Group Processing for a diagram that shows the processing flow of the #SUBR macro group.

Format







#PERF
branches to a specified subroutine.

#SUBR
specifies the start of the subroutine.

#ESUB
specifies the end of the subroutine. If save2 was specified on the #SUBR macro, reg is reloaded before control is returned.

reg
is a work register used for branching to the subroutine. If the subroutine code is physically located before the corresponding #PERF macro, the reg parameter must be specified on the #SUBR macro as well.

The register specified on the #SUBR macro must be the same register specified on the #PERF macro. If there is a conflict between the registers, an assembly error is issued and the register specified on #SUBR is ignored.

name
is the name of the subroutine.

save1
is a fullword save area into which reg is stored before branching to the subroutine. On return from the subroutine, reg is reloaded from save1.

save2
is a fullword save area into which reg is stored for the duration of the subroutine processing. This allows the subroutine to use reg during processing.

If you do not specify save2 on the #SUBR macro, reg is not saved.

PREFIX=label
specifies a prefix for all link labels generated by this macro group, where label is a 4-character alphabetic name.

code1
is the code to process for the subroutine.

Entry Requirements

None.

Return Conditions

Control is returned to the next sequential instruction.

Programming Considerations

Examples

In the following example, there is a call to subroutine XSR1RLCH.

         #PERF R14,XSR1RLCH,EBW080     Release old chain
*
*   R14 is stored in EBW080, the subroutine is executed,
*   then R14 is reloaded from EBW080.
*   Processing continues with R14 as it was before the
*   subroutine was invoked by #PERF
*   (assuming the subroutine itself did not corrupt
*   EBW080 through EBW083).
          :
          :
          :
*
         #SUBR XSR1RLCH,R14,EBW084   Chain-release subroutine
*
*   The return register (R14) is stored in EBW084 and can be
*   used in subroutine logic (but do not change the contents
*   of EBW080 through EBW087...).
          :
*   subroutine processing
          :
         #ESUB                         End of subroutine named XSR1RLCH
*                                      R14 is restored from EBW084
*                                      before the BR to return
 

Related Macros

None.