REQUEST=DETACH option of IARV64

REQUEST=DETACH allows you to free one or more memory objects.

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state and PSW key 8-15.

The caller must be running in supervisor state or with PSW key 0-7 to use the following parameters:

  • AFFINITY=SYSTEM
  • OWNER=NO
Dispatchable unit mode: Task or SRB
Cross memory mode: Any PASN, any HASN, any SASN
Note: Note that problem state caller running in PSW key 8-15 can use DETACH only when the primary address space is the home address space.
AMODE: 31- or 64-bit
ASC mode: Primary or access register (AR)
Interrupt status: Enabled for I/O and external interrupts
Locks: A local lock may be held, subject to the following limitation:

When a local lock is held for a request for non-shared memory objects, the lock must be for the address space specified (or defaulted) by the input ALETVALUE.

Control parameters: Control parameters must be in the primary address space and can reside both below and above the bar.

Programming requirements

None

Restrictions

This macro supports multiple versions. Some keywords are unique to certain versions. See PLISTVER parameter description.

Input register information

Before issuing the IARV64 macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter, or using it as a base register.

Output register information

When control returns to the caller, the GPRs contain:
Register
Contents
0
Reason code, if GPR 15 is non-zero
1
Used as a work register by the system
2-13
Unchanged
14
Used as a work register by the system
15
Return code
When control returns to the caller, the ARs contain:
Register
Contents
0-1
Used as work registers by the system
2-13
Unchanged
14-15
Used as work registers by the system

Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.

Performance implications

None

Syntax

The REQUEST=DETACH option of the IARV64 macro is written as follows:

Syntax Description
   
   name name: symbol. Begin name in column 1.
   
One or more blanks must precede IARV64.
   
IARV64  
   
One or more blanks must follow IARV64.
   
REQUEST=DETACH  
   
  ,MATCH=SINGLE Default: MATCH=SINGLE
   
  ,MATCH=MOTOKEN  
  ,MATCH=USERTOKEN  
   
  ,MEMOBJSTART=memobjstart memobjstart: RS-type address or address in register (2) - (12).
   
  ,MOTKN=motkn motkn: RS-type address or address in register (2) – (12).
   
  ,USERTKN=usertkn usertkn: RS-type address or address in register (2) - (12).
  ,USERTKN=NO_USERTKN Default: USERTKN=NO_USERTKN
   
  ,MOTKNCREATOR=USER Default: MOTKNCREATOR=USER
  ,MOTKNCREATOR=SYSTEM  
   
  ,AFFINITY=LOCAL Default: AFFINITY=LOCAL
  ,AFFINITY=SYSTEM  
   
  ,OWNER=YES Default: OWNER=YES
  ,OWNER=NO  
   
  ,TTOKEN=ttoken ttoken: RS-type address or address in register (2) - (12).
  ,TTOKEN=NO_TTOKEN Default: TTOKEN=NO_TTOKEN
   
  ,V64COMMON=NO Default: V64COMMON=NO
  ,V64COMMON=YES  
   
  ,ALETVALUE=aletvalue aletvalue: RS-type address or address in register (2) - (12).
  ,ALETVALUE=0 Default: ALETVALUE=0
   
  ,COND=NO Default: COND=NO
  ,COND=YES  
   
  ,RETCODE=retcode retcode: RS-type address or register (2) - (12).
   
  ,RSNCODE=rsncode rsncode: RS-type address or register (2) - (12).
   
  ,PLISTVER=IMPLIED_VERSION Default: PLISTVER=IMPLIED_VERSION
  ,PLISTVER=MAX  
  ,PLISTVER=0, 1, 2, 3 or 4  
   
  ,MF=S Default: MF=S
  ,MF=(L,list addr) list addr: RS-type address or register (1) - (12).
  ,MF=(L,list addr,attr)  
  ,MF=(L,list addr,0D)  
  ,MF=(E,list addr)  

  ,MF=(E,list addr,COMPLETE)

 
   

Parameters

The parameters are explained as follows:

name
An optional symbol, starting in column 1, that is the name on the IARV64 macro invocation. The name must conform to the rules for an ordinary assembler language symbol.
REQUEST=DETACH
A required parameter. REQUEST=DETACH frees one or more memory objects. Problem state programs running in PSW key (8-15) can use this function only when the primary address space is the home address space, and can affect only a memory object that is created using GETSTOR CONTROL=UNAUTH. If a problem state program running in PSW key (8–15) tries to free a memory object created with CONTROL=AUTH, the system does not free the memory object and an ABEND will be issued.

A memory object can be affected by DETACH when MATCH=SINGLE is specified without MOTKN/USERTKN. Other invocations of DETACH will affect nonshared memory objects only when a matching user token is passed.

A shared memory object can be affected by DETACH only when a matching user token is passed.

When DETACH MATCH=SINGLE AFFINITY=LOCAL USERTKN is specified against a shared memory object, the shared interest will be removed from the address space designated by ALETVALUE provided the usertoken passed still represents current shared interest by the space.
  1. If this address space has no further shared interest in the memory object, then DETACH will also remove addressability for the address space identified by the input ALETVALUE.
  2. When the last address space has surrendered its use of a given shared memory object and the system interest has been removed (through DETACH AFFINITY=SYSTEM) the memory object will be freed.

When DETACH MATCH=USERTOKEN AFFINITY=LOCAL is specified and the input user token matches the usertoken provided for a given memory object created through GETSTOR MOTKN, that memory object is freed. If the memory object was created through GETSHARED and the input user token represents current shared interest by the address space, then that interest will be removed. The same two observations as in the prior list apply.

When DETACH MATCH=USERTOKEN AFFINITY=SYSTEM is specified, only shared memory objects are affected. When the input user token matches the system interest, the system interest will be removed. If there is no remaining local interest, then the shared memory object is freed.

All I/O into each memory object specified must be complete before the DETACH is requested. If the DETACH service finds a PAGEFIXed page in the memory object, the memory object will not be freed, but any prior pages will have indeterminate data and the caller will be abnormally ended.

,MATCH=SINGLE
,MATCH=MOTOKEN
,MATCH=USERTOKEN
An optional parameter that indicates which memory objects are to be freed. The default is MATCH=SINGLE.
,MATCH=SINGLE
Specifies that the input contains MEMOBJSTART for a single memory object.
,MATCH=MOTOKEN
Specifies that the input contains a memory object token that was passed to GETSTOR, GETSHARED or SHAREMEMOBJ. Memory objects not associated with a memory object token are not affected. Such objects would have to have been created using GETSTOR without MOTKN/USERTKN. If MATCH=MOTOKEN or MATCH =USERTOKEN, COND=YES, and no matching memory object token exists, the system returns a return code instead of abnormally ending the caller.

For nonshared memory objects, all memory objects associated with this memory object token are freed unless it is a problem state program with PSW key 8-15 trying to free a memory object created with CONTROL=AUTH.

For shared memory objects, when AFFINITY=LOCAL is given, the shared interest in memory objects associated with this memory object token is to be removed (for the ALET specified through ALETVALUE). If a given shared memory object no longer has outstanding shared interest then it will be freed.

For shared memory objects, when AFFINITY=SYSTEM is given, the system interest in memory objects associated with this memory object token is to be freed. If a specified shared memory object no longer has outstanding shared interest then it will be freed.

If the system encounters an error in processing a qualifying memory object, for example, an unexpected pagefixed page, then the processing ends. The system does not process that page or any further pages or memory objects and abnormally ends the caller.

,MATCH=USERTOKEN
This is a synonym for MATCH=MOTOKEN.
,MEMOBJSTART=memobjstart
When MATCH=SINGLE is specified, a required input parameter that contains the address of the first byte in the memory object.

To code: Specify the RS-type address, or address in register (2)-(12), of an eight-byte pointer field.

,MOTKN=motokn
A optional input parameter that identifies the memory object token to uniquely identify the memory object, as previously passed to GETSTOR, GETSHARED or SHAREMEMOBJ, or the token that was generated by the system on a GETCOMMON or GETSTOR request.

Each shared memory object can be associated with multiple memory object tokens. For AFFINITY=LOCAL, the shared interest in a shared memory object associated with this memory object token is to be removed for the address space. For AFFINITY=SYSTEM, the shared interest created by GETSHARED is to be removed or the 64-bit common memory object is to be freed. For either specification of AFFINITY, when a given shared memory object no longer has outstanding shared interest, it is freed.

When the memory object is not associated with the input token value, it is not processed.

To code: Specify the RS-type address, or address in register (2)-(12), of a doubleword field, or specify a literal decimal value.

,USERTKN=usertkn
,USERTKN=NO_USERTKN
A parameter that is similar to MOTKN. Unlike MOTKN, a USERTKN is always presumed to be user-created. The default is NO_USERTKN. It is suggested that you use MOTKN rather than USERTKN. MOTKN=xxx,MOTKNCREATOR=USER is equivalent to USERTKN=xxx.

The default can be used only for memory objects created by GETSTOR. When the memory object is created by GETSHARED, it is necessary to specify the memory object token to uniquely identify which shared interest is to be freed.

To code: Specify the RS-type address, or address in register (2)-(12), of a doubleword field, or specify a literal decimal value.

,MOTKNCREATOR=USER
,MOTKNCREATOR=SYSTEM
When MOTKN=motokn is specified, an optional parameter that indicates who created the memory object token.
,MOTKNCREATOR=USER
The memory object token is user-created.
,MOTKNCREATOR=SYSTEM
The memory object token is system-created.

The default is MOTKNCREATOR=USER.

,AFFINITY=LOCAL
,AFFINITY=SYSTEM
An optional input parameter that identifies whether local or system affinity for the memory object will be affected. The default is AFFINITY=LOCAL.
,AFFINITY=LOCAL
Local affinity to the memory object is to be affected, the interest in the memory object defined by the input ALETVALUE and memory object token. Nonshared memory objects are affected by AFFINITY=LOCAL.

Shared memory objects for which an appropriate SHAREMEMOBJ has been done by the address space defined by the input ALETVALUE will also by affected by AFFINITY=LOCAL.

64-Bit Common memory objects are not affected by AFFINITY=LOCAL.

AFFINITY=SYSTEM
System affinity to the shared or 64-bit common memory object will be affected.

AFFINITY=SYSTEM can be used only by callers running in supervisor state of with PSW key 0–7.

,OWNER=YES
,OWNER=NO
When AFFINITY=LOCAL is specified, an optional keyword input that specifies whether the system will check if the ttoken provided or the task of the caller matches the ttoken associated with the memory object when it was created (only relevant for memory objects created through GETSTOR not GETSHARED). The default is OWNER=YES.
,OWNER=YES
The task which owns the memory object must match the current task or the ttoken provided.
OWNER=NO
The task which is freeing the memory object does not have to be the owner of the memory object. NO can be used only by programs running in supervisor state or with PSW key 0-7.
,TTOKEN=ttoken
,TTOKEN=NO_TTOKEN
When OWNER=YES and AFFINITY=LOCAL are specified, an optional input parameter that identifies the task that owns the memory object. The TTOKEN is returned by the TCBTOKEN macro.

If TTOKEN is not specified, the task issuing the DETACH request must be the owner of the memory object.

The task identified by the TTOKEN must be in the address space specified or defaulted by the ALETVALUE keyword.

When the TTOKEN parameter is used by problem state programs with PSW key 8-15, the target task must represent the calling task OR the jobstep task for the calling task OR the mother task. The mother task may not be given however when the calling task is itself a jobstep task.

If the TTOKEN parameter is not specified, and the caller is a TCB, the currently dispatched task must be the owner of the memory object. When OWNER=YES is specified by an SRB, the caller will be abnormally ended if the TTOKEN value is not supplied. The default is NO_TTOKEN.

To code: Specify the RS-type address, or address in register (2)-(12), of a 16-character field.

,V64COMMON=NO
,V64COMMON=YES
When AFFINITY=SYSTEM is specified, an optional input parameter that indicates whether this is memory object is a 64-bit common memory object. The default is V64COMMON=NO.
,V64COMMON=NO
This is not a 64-bit common memory object.
,V64COMMON=YES
This is a 64-bit common memory object.
,ALETVALUE=aletvalue
,ALETVALUE=0
An optional input parameter that indicates the ALET of the address space of the memory object to be freed.

The only supported values are 0 (primary) and 2 (home). The ALETVALUE parameter can be used only by programs running in supervisor state or with PSW key 0-7. The default is 0.

To code: Specify the RS-type address, or address in register (2)-(12), of a fullword field, or specify a literal decimal value.

,COND=NO
,COND=YES
An optional keyword input that specifies whether the request is unconditional or conditional. When you code COND=YES and there is insufficient storage to satisfy the request, instead of the request being abnormally ended the request will complete but a return code will be set to indicate that the request could not be completed successfully. In all cases the request will be abnormally ended for invalid requests, including violation of environmental restrictions. The default is COND=NO.
,COND=NO
The request is unconditional. The request will be abnormally ended when the request cannot be satisfied.
,COND=YES
The request is conditional. The request will not be abnormally ended for resource unavailability.
,RETCODE=retcode
An optional output parameter into which the return code is to be copied from GPR 15. If you specify register 15, the value will be left in GPR 15.

To code: Specify the RS-type address of a fullword field, or register (2)-(12) or register (15).

,RSNCODE=rsncode
An optional output parameter into which the reason code is to be copied from GPR 0.

To code: Specify the RS-type address of a fullword field, or register (2)-(12).

,PLISTVER=IMPLIED_VERSION
,PLISTVER=MAX
,PLISTVER=0, 1, 2, 3 or 4
An optional input parameter that specifies the version of the macro. PLISTVER determines which parameter list the system generates. PLISTVER is an optional input parameter on all forms of the macro, including the list form. When using PLISTVER, specify it on all macro forms used for a request and with the same value on all of the macro forms. The values are:
  • IMPLIED_VERSION, which is the lowest version that allows all parameters specified on the request to be processed. If you omit the PLISTVER parameter, IMPLIED_VERSION is the default.
  • MAX, if you want the parameter list to be the largest size currently possible. This size might grow from release to release and affect the amount of storage that your program needs.

    If you can tolerate the size change, IBM® recommends that you always specify PLISTVER=MAX on the list form of the macro. Specifying MAX ensures that the list-form parameter list is always long enough to hold all the parameters you might specify on the execute form, when both are assembled with the same level of the system. In this way, MAX ensures that the parameter list does not overwrite nearby storage.

  • 0, supports all parameters except those specifically referenced in higher versions.
  • 1, supports both the following parameters and parameters from version 0:
    • CONVERTSIZE64
    • CONVERTSTART
    • GUARDSIZE64
    • V64SHARED
  • 2, supports both the following parameters and parameters from version 0 and 1:
    • AMOUNTSIZE
    • DETACHFIXED
    • DOAUTHCHECKS
    • DUMP
    • DUMPPRIORITY
    • DUMPPROTOCOL
    • LOCALSYSAREA
    • MEMLIMIT
    • OPTIONVALUE
    • ORDER
    • OWNERASID
    • OWNERCOM
    • TYPE
    • UNLOCKED
    • USERTOKEN
    • V64COMMON
  • 3, supports both the following parameters and parameters from versions 0, 1, 2:
    • ATTRIBUTE
    • OWNERJOBNAME
    • TRACKINFO
  • 4, supports both the following parameters and parameters from versions 0, 1, 2, 3:
    • DMAPAGETABLE
To code: Specify one of the following:
  • IMPLIED_VERSION
  • MAX
  • A decimal value of 0, 1, 2, 3 or 4
,MF=S
,MF=(L,list addr)
,MF=(L,list addr,attr)
,MF=(L,list addr,0D)
,MF=(E,list addr)
,MF=(E,list addr,COMPLETE)
An optional input parameter that specifies the macro form.

Use MF=S to specify the standard form of the macro, which builds an inline parameter list and generates the macro invocation to transfer control to the service. MF=S is the default.

Use MF=L to specify the list form of the macro. Use the list form together with the execute form of the macro for applications that require reentrant code. The list form defines an area of storage that the execute form uses to store the parameters. Only the PLISTVER parameter may be coded with the list form of the macro.

Use MF=E to specify the execute form of the macro. Use the execute form together with the list form of the macro for applications that require reentrant code. The execute form of the macro stores the parameters into the storage area defined by the list form, and generates the macro invocation to transfer control to the service.

,list addr
The name of a storage area to contain the parameters. For MF=S and MF=E, this can be an RS-type address or an address in register (1)-(12).
,attr
An optional 1- to 60-character input string that you use to force boundary alignment of the parameter list. Use a value of 0F to force the parameter list to a word boundary, or 0D to force the parameter list to a doubleword boundary. If you do not code attr, the system provides a value of 0D.
,COMPLETE
Specifies that the system is to check for required parameters and supply defaults for omitted optional parameters.