Processing a dynamic SQL request

When a client sends a dynamic request, a typical mainframe server application performs the tasks in Table 1-5.

Table 1-5: Functions to process dynamic 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. Determine the event type. Determine the type of client request: RPC, language, dynamic, or cursor.

TDINFRPC

4. Determine the type of dynamic operation. This can be a dynamic prepare request, dynamic execute request, dynamic execute immediate request, request for input or output parameter descriptions, or deallocate request.

TDYNAMIC

5. Process dynamic operation. Get the statement (for prepare). Get the statement ID (for all dynamic requests).

TDYNAMIC

6. Handle the incoming parameters. Determine number of parameters (for execute). Retrieve number of parameters (for execute). Retrieve input parameters (for execute).

TDNUMPRM TDINFPRM TDRCVPRM

7. Describe the data. Describe input/output parameters, or rows to be returned.

TDSNDROW

8. Return data to the client. Send result rows for execute or execute immediate. Send an acknowledge request. Send a done package.

TDYNAMIC TDSNDDON

9. Get the next request type. Accept the incoming request.

TDGETREQ

10. End the conversation. Send final DONE package. Free the TDPROC structure. Free the MVS storage.

TDSNDDON TDFREE TDTERM