z/OS MVS Programming: Extended Addressability Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Loading the Value of Zero into an AR

z/OS MVS Programming: Extended Addressability Guide
SA23-1394-00

When the code you are writing is in AR mode, you must be very conscious of the contents of the ARs. For instructions that reference data, the ARs must always contain the ALET that identifies the address/data space that contains the data. Therefore, even when the data is in the primary address space, the AR that accompanies the GPR that has the address of the data must contain the value "0".

The following examples show several ways of placing the value "0" in an AR.

Example 1 Set AR 5 to value of zero, when GPR 5 can be changed.
            SLR  5,5            SET GPR 5 TO ZERO
            SAR  5,5            LOAD GPR 5 INTO AR 5

Example 2 Set AR 5 to value of zero, without changing value in GPR 5.
            LAM   5,5,=F'0'     LOAD AR 5 WITH A VALUE OF ZERO
Another way of doing this is the following:
            LAM   5,5,ZERO
            .
ZERO        DC    F'0'
Example 3 Set AR 5 to value of zero, when AR 12 is already 0.
            CPYA  5,12          COPY AR 12 INTO AR 5
Example 4 Set AR 12 to zero and set GPR 12 to the address contained in GPR 15. This code is useful to establish a program's base register GPR and AR from an entry point address contained in register 15. The example assumes that GPR 15 contains the entry point address of the program, PGMA.
            LAE  12,0(15,0)     ESTABLISH PROGRAM'S BASE REGISTER
            USING PGMA,12
Another way to establish AR/GPR module addressability through register 12 is as follows:
            SLR   12,12
            SAR   12,12
            BASR  12,0
            USING *,12
Example 5Set AR 5 and GPR 5 to zero.
            LAE   5,0(0,0)      Set GPR and AR 5 to zero

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014