Appendix C: Sample Language Application for CICS

This appendix contains a sample Open ServerConnect application program that processes a client’s SQL language request using the DB2 dynamic SQL facility. This CICS program uses PL/1, DB2, and Gateway-Library.

The client language request can be entered on line, using ISQL or another Sybase or third party front end, or it can be coded in a DB-Library program. A corresponding DB-Library program, syl1.c, is included with TRS. The server program listed here is included on the Open ServerConnect tape.

If the TRS security administrator specifies this program as your language handler, be sure that syl1.c is the Language RPC Name in the Transaction Group associated with all client logins that use this program to process SQL language requests.

If you want to allow a client to execute this program on line, be sure that the TRS specifies SYL1 rather than AMD2 for SQL language requests.

The purpose of this sample program is to demonstrate the use of Gateway-Library functions, particularly those designed to handle client language requests. In some cases, one Gateway-Library function is used for demonstration purposes when another function would be more efficient. In order to best illustrate the flow of processing, the program does not do extensive error checking.

NoteYou can write language handling programs to handle any incoming text. You are not restricted to SQL text or to any particular host access method.

This program demonstrates the use of the following Gateway-Library functions listed in Table C-1.

Table C-1: List of functions used in SYCPSAL1

Name

Action

TDACCEPT

Accept a client request.

TDFREE

Free up the TDPROC structure for the connection.

TDINFLOG

Return current trace settings for trace log.

TDINFPGM

Return information about current program.

TDINIT

Initialize the Gateway-Library environment.

TDRCVSQL

Receive a SQL command string from client.

TDRESULT

Describe next communication from client.

TDSETSPT

Set specific tracing.

TDSNDDON

Send results-completion to client.

TDSNDMSG

Send message to client.

TDSQLLEN

Get length of incoming text.

TDSTATUS

Get status information.