Processing a SQL language request

When a client sends a SQL select language request, a typical mainframe server application (short transaction) performs the tasks in Table 1-3.

Table 1-3: Functions to process language requests

Task

Function

1. Prepare for incoming requests. Initialize the Gateway-Library environment. Specify the type of IMS TM transaction (used with IMS TM transactions only).

TDINIT TDSETPT

2. Accept the incoming request. Accept the incoming request.

TDACCEPT

3. Handle incoming SQL statements. Determine the length (in bytes) of the incoming SQL string. Retrieve the SQL string (Loop until all parameters are retrieved).

TDSQLLEN TDRCVSQL

4. Process the request. Retrieve the requested data from the database.

5. Prepare to return results to the client.

Set the length and address of each return parameter (Loop until all parameters are described). Describe each column in a row to be returned (Loop until all columns are retrieved).

TDSETPRM TDESCRIB

6. Return data to the client. Send data to the client, one row at a time (Loop until all rows are sent). Send the return parameters, tell the client when results are finished, and close the connection.

TDSNDROW

7. End the conversation. Free the TDPROC structure. Free the MVS storage (required with IMS TM; optional but recommended with CICS).

TDFREE TDTERM