gtpc2mb5 | C/C++ Language Support User's Guide |
This function sends data to the remote transaction program.
Format
#include <tpfmap.h>
void cmsend(unsigned char *conversation_ID,
unsigned char *buffer,
signed int *send_length,
signed int *request_to_send_received,
signed int *return_code);
- conversation_ID
- This is a pointer to an 8-byte character array that contains the
conversation ID. This conversation ID must be the ID returned by the
cminit (INITIALIZE) or cmaccp (ACCEPT_CONVERSATION) that
started this conversation.
- buffer
- This is a pointer to a location in memory that contains the data to be
sent. The length of the data is specified by the send_length
parameter.
- send_length
- This is a pointer to a 4-byte field that contains the number of bytes of
data that are to be sent. This value can be from
0-32 767. If this parameter is 0, a null data record
is sent.
- request_to_send_received
- This is a pointer to a 4-byte field where a REQUEST_TO_SEND notification
is placed. Possible values are:
- CM_REQ_TO_SEND_RECEIVED
- This value indicates that the local program received a REQUEST_TO_SEND
notification from the remote program. This is a request that the local
program enter receive state, which allows the remote program to
enter send state.
- CM_REQ_TO_SEND_NOT_RECEIVED
- This value indicates that a REQUEST_TO_SEND notification was not
received.
- return_code
- This is a pointer to a 4-byte field where the return code will be
placed.
Return Codes
The following is a list of return codes that can be returned to the program
that called the cmsend function. A complete list of the
return codes and their definitions can be found in Table 45.
- CM_OK
- CM_CONVERSATION_TYPE_MISMATCH
- CM_DEALLOCATED_ABEND
- CM_PRODUCT_SPECIFIC_ERROR
- CM_PROGRAM_ERROR_PURGING
- CM_PROGRAM_PARAMETER_CHECK -- Either conversation_ID or
send_length is invalid.
- CM_PROGRAM_STATE_CHECK -- The program is not in send or
send-pending state.
- CM_RESOURCE_FAILURE_NO_RETRY
- CM_RESOURCE_FAILURE_RETRY
- CM_SVC_ERROR_PURGING
- CM_SYNC_LVL_NOT_SUPPORTED_PGM
- CM_TP_NOT_AVAILABLE_NO_RETRY
- CM_TP_NOT_AVAILABLE_RETRY
- CM_TPN_NOT_RECOGNIZED.
Programming Considerations
- You can execute this function on any I-stream.
- The conversation must be in send or send-pending
state.
- The value supplied in conversation_ID must be the conversation ID
returned by the cmaccp or cminit function.
- The following characteristics can affect this function:
- send_type
- prepare_to_receive_type
- deallocate_type.
- sync_level
- The conversation enters receive state when cmsend is
called with send_type set to CM_SEND_AND_PREP_TO_RECEIVE
and return_code is CM_OK.
- The conversation terminates when cmsend is called with
send_type set to CM_SEND_AND_DEALLOCATE and
return_code is CM_OK.
- The conversation enters send state if the conversation was in
send-pending state, return_code is CM_OK, and the
send_type characteristic is set to CM_BUFFER_DATA,
CM_SEND_AND_FLUSH, or CM_SEND_AND_CONFIRM.
- When the request_to_send_received parameter is
CM_REQ_TO_SEND_RECEIVED, the remote program is requesting the local
TPF transaction program to enter receive state and thereby place
the remote program in send or send-pending state.
The local TPF transaction program enters receive state by issuing
cmrcv or cmptr. The remote partner program enters
the corresponding send or send-pending state when it
calls cmrcv and receives the SEND indication on the
status_received parameter.
- The data pointed to by buffer is plain data with no header or
length fields. The length is determined from the send_length
parameter. It is treated as a single, complete logical record.
- The entire storage area referred to by the buffer and
send_length parameters must be addressable by the TPF/APPC support
code.
Examples
The following example sends data to the remote transaction program.
#include <tpfmap.h>
unsigned char convid[8];
unsigned char *buff;
signed int len;
signed int rtsr;
signed int rcode;
.
.
/* set conversation_ID with value returned from accept or initialize */
.
.
cmsend(convid,buff,&len,&rtsr,&rcode);
. /* normal processing path */
.
.
Related Information