Appendix B: Sample RPC Application for CICS

This appendix contains a sample host server application program that processes a client RPC from the Open Client DB-Library program syr1.c. The server program listed here is included on the Open ServerConnect package; syr1.c is included with TRS.

The purpose of this sample program is to demonstrate the use of Gateway-Library functions, particularly those designed to handle remote procedure calls from a client. 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.

This sample program is provided as part of the Open ServerConnect package. It references a table, SYBASE.SAMPLETB, which you create from the SPUFI input file SYGWSDAT provided with this product.

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

Table B-1: List of functions used in SYCPSAR1

Name

Action

TDACCEPT

Accept a client request.

TDCONVRT

Convert data from host datatype to DB-Library datatype.

TDESCRIB

Describe a column.

TDFREE

Free up the TDPROC structure for the connection.

TDGETUSR

Get user login information from the client.

TDINFBCD

Get BCD information for a described column.

TDINFPRM

Get information about one RPC parameter.

TDINFUDT

Get the user-defined datatype of a column.

TDINIT

Initialize the Gateway-Library environment.

TDLOCPRM

Return ID of one RPC parameter based on name.

TDNUMPRM

Get total number of RPC parameters.

TDRCVPRM

Receive RPC parameter from client program.

TDRESULT

Describe next communication from client.

TDSETBCD

Set scaling for a described column.

TDSETLEN

Set the length for a described column.

TDSETPRM

Set one return parameter.

TDSETUDT

Set a column’s user datatype.

TDSNDDON

Send results-completion to client.

TDSNDMSG

Send message to client.

TDSNDROW

Send row to client.

TDSTATUS

Get status information.