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 data space that contains the data. 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 zero.
The following examples show several ways of placing the value zero in an AR.
SLR 5,5 SET GPR 5 TO ZERO
SAR 5,5 LOAD GPR 5 INTO AR 5
LAM 5,5,=F'0' LOAD AR 5 WITH A VALUE OF ZERO
LAM 5,5,ZERO
ZERO DC F'0'
CPYA 5,12 COPY AR 12 INTO AR 5
PGMA CSECT ENTRY POINT
.
.
LAE 12,0(15,0) ESTABLISH PROGRAM'S BASE REGISTER
USING PGMA,12
LAE 12,0
BASR 12,0
USING *,12
LAE 5,0(0,0) Set GPR and AR 5 to zero