Issuing the TREQ ALLOC Statement

After you have set the session and conversation attributes in the UIOCB, you must issue a #TREQ ALLOC statement to allocate the session.
idmscu
After you have set the session and conversation attributes in the UIOCB, you must issue a #TREQ ALLOC statement to allocate the session.
 
Coding Considerations
 
You should consider the following parameters when coding your #TREQ ALLOC statement:
  • The OPTNS=ANY/CONN/IMM parameter of the #TREQ ALLOC statement establishes criteria for choosing a session. The session you need can be in one of three states:
    •  
      Immediately available
       -- The session has already been established with the requested LU and is not currently in use.
      (LU6.2 only); the session must be a contention winner to be considered immediately available.
      For more information about contention winners, see the 
      System Generation documentation
      .
    •  
      Disconnected
       -- The session has not yet been established.
    •  
      Busy
       -- The session has been established, but is currently allocated to another logical unit. The session will become 
      immediately available
       when that logical unit ends its conversation.
    The options on the #TREQ ALLOC statement are as follows:
    •  
      ANY
       (default) specifies that CA IDMS/DC tries to allocate a session in the following order:
      A session that is 
      immediately available
       and currently unused.
      A session that is 
      disconnected
      .
      A session that is 
      busy
      ; CA IDMS/DC will wait for a busy session and return control to your program once the session is allocated.
    •  
      CONN
       requests CA IDMS/DC not to wait for a busy session. CA IDMS/DC will first attempt to allocate an immediately available session, then a disconnected session.
    •  
      IMM
       specifies that only immediately available sessions are acceptable for the allocation request.
  • You can specify whether your #TREQ ALLOC request is made synchronous (default) by specifying OPTNS=WAIT or asynchronous by specifying OPTNS=NOWAIT.
    If you specify OPTNS=ANY, do not request asynchronous processing with OPTNS=NOWAIT. OPTNS=ANY implies that the request may wait for a busy session.
  • The UIOCB parameter of the #TREQ ALLOC statement establishes a UIOCB for the conversation.
 
Example of LU-LU Session Allocation
 
The following example illustrates how you would allocate an LU-LU session, establishing the UIOCB, and setting session and conversation attributes:
  • The first statement obtains storage for the UIOCB.
  • The next statement establishes the remote logical unit.
  • The next four statements establish LU6.2 conversation attributes.
  • The #TREQ ALLOC statement allocates the session, initiates the conversation, and names the UIOCB.
UIOSTG #GETSTG TYPE=(USER,LONG),PLIST=*,LEN=UIOLEN,INIT=X'00', * STGID=UIOCBD,ADDR=(R1) * SESSION ATTRIBUTES ATTR MVC UIORLU,=C'VTMFO178' REMOTE LU * CONVERSATION ATTRIBUTES MVC UIOUSER,=C'BRANCH01' USER ID: DENVER BRANCH MVC UIOPASS,=C'DENPR ' USER PASSWORD: DENVER MVI UIOCONV,UIOCONVM MAPPED MODE MVI UIOSYNC,UIOSYNCC MAXIMUM SYNC-LEVEL #TREQ ALLOC,UIOCBA=UIOCB,COND=ALL
 
After Issuing #TREQ ALLOC
 
After you have issued your #TREQ ALLOC request, you need to perform the following:
  • Check the value in register 15:
    •  
      If register 15 contains a nonzero value
      , the allocation request failed. The UIOUCM2 field in the UIOCB indicates whether the problem is permanent or temporary:
      • If CA IDMS/DC returns UIOALFR to the UIOUCM2 field, the allocate request was denied due to a temporary problem; for example, CA IDMS/DC was unable to wait for a busy session. In this case, you should issue the #TREQ ALLOC request again.
      • If CA IDMS/DC returns UIOALFN to the UIOUCM2 field, a permanent error was encountered.
      • If CA IDMS/DC returns UIOALFS to the UIOUCM2 field, the specified sync level for the conversation is not supported. This is a permanent error.
    •  
      If register 15 contains 0
      , the session has been successfully established. Register 1 contains the logical terminal address (LTEADDR) of the remote LU. The logical terminal address (also stored in UIOLTEA) must be specified on all subsequent #TREQ requests in that session because a single task can have conversations with many logical units.
  • If the #TREQ request was asynchronous (OPTNS=NOWAIT), you must issue a #TREQ CHECK statement before you make any further I/O requests. Your program must specify the LTE address of the remote LU (UIOLTEA) to identify the conversation.