Processing a long-running transaction

When a client sends a series of RPCs, a typical mainframe server application (long-running transaction) performs the tasks in Table 1-6. The arrows in the table indicate code loops.

Table 1-6: Functions to process long-running transactions

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 parameters. Determine how many parameters were sent. → Loop until all parameters are retrieved.

TDNUMPRM TDINFPRM TDRCVPRM

4. Process the request. Perform the requested task(s).

5. Prepare to return results to the client. → Loop to describe return parameters and columns in return rows.

TDSETPRM TDESCRIB

6. Return data to the client → Send rows and return parameters to the client (For final TDSNDDON, you must set STATUS to TDS-DONE-FINAL and CONN-OPTIONS to TDS-ENDREPLY).

TDSNDROW TDSNDDON

7. Accept next request. Accept the incoming request.

TDGETREQ

8. Repeat steps 3-6. Repeat steps 3–6 for each successive request (For final TDSNDDON, you must set STATUS to TDS-DONE-FINAL and CONN-OPTIONS to TDS-ENDRPC).

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

TDFREE TDTERM