Using access registers

For storing data, MVS™ offers a program the use of a virtual storage area called a data space. Assembler instructions (such as Load, Store, Add, and Move Character) manipulate the data in a data space. When you use instructions to manipulate data in a data space, your program must use the set of general purpose registers (GPRs) plus another set of registers called access registers. This chapter describes how to use access registers to manipulate data in data spaces.

Through access registers, your program can use assembler instructions to perform basic data manipulation, such as:
  • Moving data into and out of a data space, and within a data space
  • Performing arithmetic operations with values that are located in data spaces

To fully understand how to use the macros and instructions that control data spaces and access registers, you must first understand some concepts.

What is an access register (AR)? An AR is a hardware register that a program uses to identify an address space or a data space. Each processor has 16 ARs, numbered 0 through 15, and they are paired one-to-one with the 16 GPRs. When your program uses ARs, it must be in the address space control mode called access register (AR) mode.
ieaa6f04

ARs are used when fetching and storing data, but they are not used when doing branches.

What is address space control (ASC) mode? The ASC mode controls where the system looks for the data that the program is manipulating. Two ASC modes are available for your use: primary mode and access register (AR) mode.
  • In primary mode, your program can access data that resides in the program's primary address space. When it resolves the addresses in data-referencing instructions, the system does not use the contents of the ARs.
  • In AR mode, your program can access data that resides in the address space or data space that the ARs indicate. For data-referencing instructions, the system uses the AR and the GPR together to locate an address in an address space or data space.
How does your program switch ASC mode? Use the SAC instruction to change ASC modes:
  • SAC 512 sets the ASC mode to AR mode.
  • SAC 0 sets the ASC mode to primary mode.

What does an AR contain? An AR contains a token, an access list entry token (ALET). An ALET is an index to an entry on the access list. An access list is a table of entries, each one of which points to an address space, data space, or hiperspace to which a program has access.

Figure 1 shows an ALET in the AR and the access list entry that points to an address space or a data space. It also shows the address in the GPR that points to the data within the address/data space.
Figure 1. Using an ALET to Identify an Address Space or a Data Space
ieaa6f01

For programs in AR mode, when the GPR is used as a base register in an instruction, the corresponding AR must contain an ALET. Conversely, when the GPR is not used as a base register, the corresponding AR is ignored.

By placing an entry on an access list and obtaining an ALET for the entry, a program builds the connection between the program and an address space, data space, or hiperspace. The process of building this connection is called establishing addressability to an address space, data space, or hiperspace. To add the entry to the access list, your program uses the ALESERV macro, which is described in The ALESERV macro.

A program adds an entry to an access list so that it can:
  • Gain access to a data space or an address space through assembler instructions.
  • Obtain the ALET for a hiperspace. With that ALET, the program can use the HSPALET parameter on HSPSERV to:
For the rest of this information, assume that entries in access lists point to data spaces, not hiperspaces or address spaces.
  • The subject of inter-address space communication, appropriate only for programs in supervisor state or with PSW key 0 - 7, is described in z/OS MVS Programming: Extended Addressability Guide.
  • Because a program cannot use ARs to directly manipulate data in a hiperspace, the subject of how a program uses ARs and access lists to access hiperspaces differs from the discussion in the rest of this chapter.