Selecting the storage key

The storage key helps control read and write access to the virtual storage area. You need to choose a storage key that will allow access by those programs that require it. To limit unwanted access by other programs, try to select a storage key different from the PSW key that other programs are likely to use.

The storage key controls user access as follows:
The amount of control you have over the storage key assigned to your virtual storage request varies depending on the subpool from which you request storage. For the purpose of storage key assignment, there are three types of subpools. The first type of subpool is always assigned a particular storage key, such as 0. The second type of subpool is assigned its storage key based on the key in the requesting task's TCB at the time of that task's first storage request. The third type of subpool allows you to select the storage key by:

These subpools are shown in the subpool table (Table 1) as having a selectable storage key. Detailed information about subpools with selectable storage keys is provided in Table 1.

Table 1. Storage Keys for Selectable Key Subpools
Subpool Macros and Parameters Storage Key
129-132
  • GETMAIN with LC, LU, VC, VU, EC, EU, or R; BRANCH not specified
  • FREEMAIN with LC, LU, L, VC, VU, V, EC, EU, E, or R; BRANCH not specified
  • STORAGE with OBTAIN or RELEASE; CALLRKY=YES is specified
The storage key equals the caller's PSW key. (The KEY parameter is not allowed.)
129-132
  • GETMAIN with LC, LU, VC, VU, EC, EU, or R; BRANCH=YES specified
  • FREEMAIN with LC, LU, L, VC, VU, V, EC, EU, E, or R; BRANCH=YES specified
The storage key is 0. (The KEY parameter is not allowed.)
129-132
  • GETMAIN with RC, RU, VRC, VRU; BRANCH not specified
  • FREEMAIN with RC, RU; BRANCH not specified
  • CPOOL with BUILD
The storage key is the key the caller specifies on the KEY parameter. If KEY is not specified, the default equals the caller's PSW key.
129-132
  • GETMAIN with RC, RU, VRC, VRU; BRANCH=YES specified
  • FREEMAIN with RC, RU; BRANCH=YES specified
  • STORAGE with OBTAIN or RELEASE; CALLRKY=YES is omitted, or CALLRKY=NO is specified
The storage key is the key the caller specifies on the KEY parameter. If KEY is not specified, the default is 0.
227-231, 241, 249
  • All GETMAIN requests with BRANCH not specified
  • All FREEMAIN requests with BRANCH not specified
  • STORAGE with OBTAIN or RELEASE; CALLRKY=YES specified
The storage key equals the caller's PSW key. (For RC, RU, VRC, and VRU, the KEY parameter is ignored. For other GETMAIN and FREEMAIN requests, the KEY parameter is not allowed.)
227-231, 241, 249
  • GETMAIN with LC, LU, VC, VU, EC, EU, or R; BRANCH=YES specified
  • FREEMAIN with LC, LU, L, VC, VU, V, EC, EU, E, or R; BRANCH=YES specified
The storage key is 0 (The KEY parameter is not allowed.)
227-231, 241, 249
  • GETMAIN with RC, RU, VRC, VRU; BRANCH specified
    Note: BRANCH=(YES,GLOBAL) is not valid for subpools 229, 230, and 249.
  • FREEMAIN with RC, RU; BRANCH specified
    Note: BRANCH=(YES,GLOBAL) is not valid for subpools 229, 230, and 249.
  • STORAGE with OBTAIN or RELEASE; CALLRKY=YES omitted, or CALLRKY=NO specified
The storage key is the key the caller specifies on the KEY parameter. If KEY is not specified, the default is 0.
227-231, 241, 249
  • CPOOL with BUILD
The storage key is the key the caller specifies on the KEY parameter. If KEY is not specified, the default equals the caller's PSW key.