Using ARRs

An ARR provides recovery for a stacking PC routine and receives control if the stacking PC routine encounters an error. An ARR is an ESTAE-type recovery routine. An ARR receives all of the defaults of the ESTAEX macro, with the exception of the TERM parameter. For ARRs, the system uses TERM=YES.

To define an ARR, either:

You activate an ARR when you issue the PC instruction; you deactivate an ARR when you issue the corresponding PR instruction.

While the stacking PC routine is running, you cannot deactivate its ARR. Therefore, if you do not want an ARR associated with the stacking PC routine, do not code the ARR parameter on the ETDEF macro.

An ARR receives control in 31-bit or 64-bit addressing mode depending on the mode specified via the ETDEF macro or the mode at the time that IEAARR was issued. If it is passed an SDWA, the SDWA is in 31-bit addressable storage.

A stacking PC routine can also have an FRR; however, if the stacking PC routine has an FRR, its ARR gets control only if the FRR percolates. The writer of a stacking PC routine should be aware of the environment in which the routine is called. The system does not give control to an ARR in the following circumstances:

If you issue an IEAARR macro to establish an ARR, you can skip the following instructions until the end of this information. See Setting up, passing, and accessing the parameter area for explanations of passing parameter areas for IEAARR.

If you define the ARR via the ETDEF macro, the stacking PC routine can use the 8-byte modifiable area of the current linkage stack entry to pass parameters to the ARR. To store data into this 8-byte area, the stacking PC routine can use the modify stacked state (MSTA) instruction. The stacking PC routine might, for example, store the address of a footprint area into the first 4 bytes and the ALET identifying the footprint area's address space into the second 4 bytes.

The following example shows how a stacking PC routine can use the 8-byte modifiable area of the linkage stack to pass parameters to an ARR.
Figure 1. Passing Parameters to an ARR
         LAE    2,PARMAREA      GET ALET AND ADDRESS OF PARMAREA
         EAR    3,2             PUT CONTENTS OF AR2 INTO GPR3
         MSTA   2               PLACE ALET AND ADDRESS OF PARMAREA
*                               INTO LINKAGE STACK
The assembler instructions perform the following functions:

When the ARR receives control, the SDWAPARM field contains the address of a copy of the 8-byte modifiable area of the linkage stack entry established by the stacking PC routine associated with the ARR. For example, suppose PGM1 uses a stacking PC to call PCRTN1. After PCRTN1 gets control, it encounters an error and control passes to the ARR associated with the stacking PC routine. At this time, SDWAPARM contains the address of a copy of the modifiable area in the linkage stack entry associated with the stacking PC routine. Note that SDWAPARM does not necessarily contain the address of a copy of the current entry. Between the time it received control and encountered the error, PCRTN1 could have added an entry to the linkage stack through a BAKR instruction. This entry would be the current entry; SDWAPARM contains the address of a copy of a previous entry.

If there is no SDWA, the ARR receives the copy of the 8-byte area in GPR/AR 2: GPR 2 contains the first 4 bytes, and AR 2 contains the second 4 bytes.

If there is no SDWA when the recovery routine requests a retry, the system uses the linkage stack entry that was current when the ARR's stacking PC routine was entered, and from that entry, provides a copy of the current contents of the 8-byte modifiable area in GPR/AR 1.

You have the option to allow or prevent asynchronous interrupts from interrupting an ARR while it is running. To allow asynchronous interrupts, specify ASYNCH=YES on the ETDEF macro. To prevent asynchronous interrupts from interrupting the ARR, specify ASYNCH=NO. If the ARR uses any supervisor services that depend on an asynchronous interrupt for successful completion, specify ASYNCH=YES.

You also have the option to allow cancel or detach processing to interrupt an ARR while it is running or to prevent this interrupt. To allow the interrupt, specify CANCEL=YES on the ETDEF macro. To prevent the interrupt, specify CANCEL=NO. If you specify CANCEL=NO, and a cancel or detach is attempted while the ARR is running, the ARR completes running before the system begins cancel or detach processing. The routine that issues ETDEF cannot use CANCEL=NO unless the stacking PC routine to be associated with the ARR runs in supervisor state or with PSW key 0 - 7.

One ARR can serve multiple stacking PC routines. In this case, each stacking PC routine must not only store information about where in its processing the stacking PC routine is, but must also store information that identifies which stacking PC routine it is.