Distributed SQL application flow for VTAM® connections

When the application program (the requester) issues the first SQL statement that references a remote database system, an LU6.2 conversation must be established with the remote database system (the server).

The APPC ALLOCATE verb is used to establish a conversation. When you look at a System Network Architecture (SNA) buffer trace, an ALLOCATE verb can easily be spotted, because the first path information unit (PIU) transmitted after the ALLOCATE is marked with the begin bracket (BB) flag. Path information unit is the structure for transmitting data through the network.

Once the LU6.2 conversation is allocated, the local Db2 system builds a message that represents the application's SQL statement. The APPC SEND_DATA verb is used to send the SQL statement to the server for processing. During transmission, the message that represents the SQL statement is broken up into path information units (PIUs), where the SQL data in each path information unit (PIU) is no larger than the request unit (RU) size that is selected by the communication administrator. If the data does not fill a complete PIU, the data remains in the APPC buffer until the PREPARE_TO_RECEIVE verb is issued.

System Network Architecture (SNA) pacing is what the receiver application can use to control the rate at which the sending application transmits data. A pacing window can be defined, which specifies the maximum number of path information units that can be transmitted by the sender before the sender must wait for the receiver to process the data. The sender must request pacing responses at the intervals that are dictated by the pacing window size.

The requester's Db2 system issues the APPC PREPARE_TO_RECEIVE verb to tell the server that it is waiting for an answer to the SQL statement. The PREPARE_TO_RECEIVE verb transmits the very last path information unit (PIU) for the SQL statement, and marks the path information unit (PIU) with the change direction (CD) indicator. When the path information unit (PIU) immediately follows an ALLOCATE verb, the path information unit (PIU) is also marked with the BB (Begin Bracket) indicator.

When the server detects the change direction (CD) indicator, it knows the SQL statement is complete and the requester is waiting to receive the answer to the SQL statement.

The server runs the SQL statement, and builds a reply message that represents the answer to the SQL statement. As before, the answer message is broken into path information units for transmission, with the last path information unit (PIU) in the answer marked change direction (CD). The change direction (CD) indicator tells the requester that the SQL answer is complete, and the server is waiting for the next SQL statement.

The requesting database returns the SQL answer to the application program, and waits for the next SQL request from the application.

The next SQL request is also converted into a message that represents the application's SQL statement.

The message is broken into path information units for transmission, where the last path information unit (PIU) is marked change direction (CD). In this case, the SQL request fits in a single PIU. As before, the change direction (CD) indicator tells the server that the SQL statement is complete, and the requester is awaiting the answer message.

The server sends the reply message, marking the last path information unit (PIU) with change direction (CD).

When the application program terminates, a DEALLOCATE verb is issued by the requesting database to tell the database server that the distributed database application is complete. The DEALLOCATE verb causes a path information unit (PIU) containing the conditional end bracket CEB flag to be transmitted to the server, which tells the server that the application is complete.