Previous Contents Index DocHome Next |
iPlanet Application Server Enterprise Connector for CICS Developer's Guide |
Chapter 4 Server-Side API Communication
This chapter describes Connector-to-CICS communications and the API you can use to communicate from iPlanet Application Server for CICS to an connector.
Note This chapter is relevant only if your CICS program is not DPL-compliant.
This chapter contains the following sections:
Connector-to-CICS Communication API
Connector-to-CICS Communication API
iPlanet Application Server Enterprise Connector for CICS comes with an Connector-to-CICS communication API that enables standard CICS applications to directly interact with the application server.Modifications are necessary when the desired application does not follow the DPL (Distribution Program Link) guidelines, and combines user interface with business logic. iPlanet Application Server for CICS provides an API to write more advanced applications that conduct full conversations with an application.
For applications that combine user interface, replace user interface call (send and receive maps) with calls to the API to send and receive a buffer from the application server.
If you want to write a program within the server application in a CICS system that:
The application server
A full conversation ensues with each side receiving and sending information.
To fully envision the above example, consider a band transfer at an automatic teller. The remote unit converses with the mainframe by sending and receiving information. The mainframe responds by receiving and sending back information.
The API described in this chapter is used to convert, converse, and communicate with an application server.
How the Communication API Works
The communication API deals with client and servers (requester and responder). In our case the Relay acts as a client and the user-server application acts as the server.The application that initiates communication via the communication API is defined as the client application. when a client application initiates a call to remote service, the communication API starts the service application on the remote platform and manages an APPC or TCP/IP session in order to conduct the conversation.
In IAs for CICS, the Relay acts as the client in the protocol, and the CICS server applications act as the server.
Figure 4-1   
How the Communication API Works
A Simple Conversation
The client application calls the remote procedure in the same manner as it would call a local procedure. When the client application regains control, the result of the procedure call is returned to it and the service application is terminated.
Figure 4-2   
A Simple Conversation
An Advanced Conversation
The client application calls the remote procedure as it would call a local procedure. The remote procedure then stays active and a logical conversation is conducted between the client and service applications, until it is terminated by one of the partners.The logical conversation is conducted using a protocol that is in one of the following states:
The client application is sending data and the service application is receiving.
The interface between the applications and the communication API is conducted through a connection record which contains all of the parameters used for conducting a remote procedure call and the data passed between the application.The service application is sending data and the client application is receiving.
the conversation is reset, i.e., it has ended or has not yet started.
The client application uses communication record to specify which remote application it requests to call. The location and characteristics of the service applications are read from an external-application table which contains the names and characteristics of applications.
In addition to session management, the communication API provides the services for client and service applications listed in the following table.
The Connection Record
The connection record serves as an interface between the application and the communication API. The record consists of protocol data that is used by the communication API to communicate with the remote application, and a user data buffer which is provided by the application for input and output of information from the remote application. The connection record format is used by client and service applications although the roles of the fields are not always the same.The communication record must be initialized according to the operation being requested from the communication API. The following table specifies the format of the connection record. For information about the specific format for your environment see the sections on calling the communication API.
In the communication API there are two versions of the connection record: 1.1 and 2.0. The following table specifies the format of the connection record version 2.0
The RPC Protocol States
The protocol implemented by the communication API is designed to provide simplicity for application programmers when they develop a conversation.The conversation is started by the client application from an inactive state. The client application's first call to the communication API identifies the service application and other conversation parameters. The first call starts the service application on the remote platform, if it has not already been started. The conversation then continues until one of the applications stops it either normally or abnormally; at which point the conversation enters the E state.
After each call to the communication API the new state of the conversation is returned in the applind field of the connection record. One of the following values of applind will be returned after every successful call to the communication API"
M - the conversation is in M state.
The client and service applications must adhere to the rules of each state as they are described in this chapter.S - The conversation is in S state.
E - the conversation was ended.
The following table defines the three states of the protocols.
Client Application Requests
The client application is always the initiator of a conversation. Similar requests are issued when the conversation is in E and M states. The E state for the client application is a form of the M state. The following table describes the application requests that can be issued when the client is in either E or M states.
The following request is allowed only when the conversation has not started yet; is in E state.
The following requests are allowed only when the client application is sending data to the service application; conversation is in the M state.
The following request is only allowed when the client is expecting to receive data; in the S state.
The following table summarizes the requests that are allowed in each state, and the possible resulting states after the call is completed.
Table 4-8 Summary of States and Results
Either M, S or E depending on the service application reply.
Either M, S or E depending on the service application reply.
Service Application Request
The service application is either initiated by the communications layer of the communication API, in which case it is an automatic responder, or the service application can start on its own and wait for incoming requests. In such a case it is called a "persistent responder". Nevertheless, the protocol that the service application uses is always the same. The conversation for the service application begins in the E state as for the client application. The E state is almost the same as the M state and differs only in the fields of the connection record that should be filled.
The following application request can be issued when the service is in either E or M states.
The following requests are only allowed when the conversation is in the S state.
The following table summarizes the requests that are allowed in each state and the possible resulting states after the call is completed.
Table 4-11 Requests Allowed in Each State and Possible Resulting States after Call
Connection Record Field Usage
The tables below specify connection record field usage in the communication API calls. Each side, client and service, is specified in two tables: the first table specifies which fields can be used for input and the second table specifies which fields are used for output when the request is completed.
Table 4-12 Connection Record Field Usage Conventions
The following table summarizes which fields must be set up for every client request. The first column specifies the special case where the request is issued in the E state.
Table 4-13 Client Request Field Settings
The following table summarizes which fields returns relevant values after each client request.
Table 4-14 Field Returns after Client Request
The following table summarizes which fields should be initiated for every service request. The first column in the table specifies the special case where the request is issued in the E state.
Table 4-15 Field That should be Initiated for Every Service Request
The following table summarizes which fields return relevant values after every service request
Table 4-16 Field That Returns Relevant Values After Every Service Request
Protocol Examples
The communication API application interface is very simple and easy to use. The following examples illustrate the protocol as discussed previously. These examples are valid in all environments, however there are some environmental specific considerations which are described in the implementation sections of this manual.
Example 1: A Simple Conversation
The client application calls a service application on a remote system with a request. After the call is completed the data field of the connection record contains the reply to the request. The whole conversation is conducted from the client application in one call and from the service application in two. In this case the protocol is transparent to the application programmer and there is no need to check the applind field at all.
Figure 4-3    A Simple Conversation
The client application calls the communication API with an ME, indicating that the service application is SRVI and provides the request in the data field of the connection record (D1). The service application is initiated and immediately calls the communication API with an M in the applreq (this is the only thing that the service application can do in the E state). The communication API returns to the service application with the request data (D1) and with the indication S, meaning that the service application is now the sender.
The service application now processes the request and calls the communication API with the response (R1) in the data field and the applreq SL, meaning that conversation control should return to the client application. This again is the only option allowed for the ME sequence. The communication API now returns to the client application and to the service application with the applind indicating an E state (conversation is over). In the data field of the client application, the communication API returns the response R1.
When the client application issues an ME from the E state, the sequence described above is the only one possible.
Example 2: A Flip-flop Conversation
The client application issues a series of remote procedure calls. Each procedure call might contain a request. When returning from each procedure call the reply to the request is available in the data field of the connection record.
Figure 4-4    A Flip-flop Conversation
The client application starts the conversation with an ML request which is the same as ME except that the conversation is not automatically ended. The service application is initiated and, as always, issues an M request. the service application receives the first data (D1) and an applind indicating that it is in the S state. The service application then issues an SL request with the response to D! (R1). when the client application gets control back, it returns to the M state. The whole process can then be repeated. In this case, when the client and service applications obtain control they are always in control of the conversation. When the client application has no more requests, it issues the applreq E, at which point the communication API responds with an applind E to both sides of the conversation.
Example 3: A Multi-record Request With One Reply
The client application sends a series of request records and obtains the reply when it issues an ML request at the end of the series.there is no data returned as a result of the M requests.
Figure 4-5    A Multi-record Request With One Reply
The client application issues a series of M requests. The first M request differs from the others only by the usage of the connection record fields. The loop of M requests end with an ML request. The service application must match each M request with its own M request. When the client application issues an ML request the service application finds this out by finding an S state in the applind field. The service application is then in control and issues an Se request which passes the response R1 in the data field. the communication API then indicates to the client application that the conversation has ended with an E state. The client application regains control when control is returned to it and issues an E request to end the conversation.
The previously described scenarios are just examples. Any combinations of the protocol are valid as long as they stay within the rules specified in this chapter. When designing client and service applications, the protocol used should be coordinated on both sides. Although the communication API is called differently on different platforms such as UNIX, PC and Legacy systems, the requests and indications used are the same. This will make it easier to coordinate the protocol on different platforms.
In CICS, the Connector-to-CICS communication API is called by linking to a program with the connection record in the COMAREA. There are two programs which can be linked-to in order to communicate through Connector-to-CICS communication API:
SRVRQRPC - Provides services for client applications.
Under CICS the primary facility (terminal) of a client application is the one from which it is started depending on the user. A normal CEDF can be used for debugging such applications. the primary facility of service applications is the connection. Service applications are started by APPC and usually link to Connector-to-CICS communication API to get the first request. To debug the application, the following command should be issued in CICS:SRVRSRPC - Provides services for service applications.
Note Under CICS only the blocking interface is available.
When a connection is operational it should be in ACQ and INS states, otherwise the connection is not logged correctly. In order to see the reason why a connection has failed to logon, the CICS log and Netview information can help. In case of difficulty, notify the system and network support at your installation site.
When a service is started from the connection and a CEDF is issued, the issuing terminal will run a CEDF session in a normal manner. When debugging a conversation in this manner, all conversations on this session will be monitored. this may cause considerable confusion on the debugging terminal since all CEDF screens from different transactions will appear on the debugging terminal simultaneously. It is therefore advisable to debug conversations when running standalone on a certain connection.
The following sequences show how a programmer might prepare a connection record for the first call to Connector-to-CICS communication API in different environments under CICS. The connection record is also shown for each one of the environments.
Previous Contents Index DocHome Next
Copyright © 2000 Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All rights reserved.
Last Updated June 09, 2000