OSI/MHS P7 Application Programmatic Interface (P7 API) Manual

C Language Example Program
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
E-6
short int nchar; /* Used in AWAITIOX call */
short int fileNum; /* Used in AWAITIOX call */
/* Await completion on all files */
printf( "Awaiting completion on all files.\n");
fileNum = -1; /* All files */
timeLimit = -1; /* No timeout */
status = AWAITIOX (&fileNum, (long *)&ReplyBufferPtr, &nchar,
&tag, timeLimit);
/* if there was no completion (ie an error) */
if (status != CCE)
{
if ( isSendFile(fileNum) )
sendCompletion(fileNum, ReplyBufferPtr );
else
if ( isResultFile(fileNum) )
resultCompletion(fileNum, ReplyBufferPtr );
else
{
/*
* Determine what the error is.
*/
status = FILEINFO(fileNum, &error);
reportFileError(ZFIL_VAL_AWAITIOX,error);
}
}
else /* process the succesful I/O operation completion */
if (isSendFile(fileNum))
{
/* Process Completion on send file */
sendCompletion (fileNum, ReplyBufferPtr );
}
else
if (isResultFile(fileNum))
{
/* Process data received from OSI/MHS */
resultCompletion(fileNum, ReplyBufferPtr );
}
else reportError ("Invalid file number returned by AWAITIOX");
} /* end of awaitCompletion */
#pragma page
/***************************************************************************/
/* Function name: sendData */
/* */
/* Arguments: buffer */
/* connection */
/* dataType */
/* */
/* Description: This function will send the P7 requests depending on */
/* the dataType passed in. If the dataType is MSBIND, */
/* then the LO group is opened and an attempt is made to */
/* send an MSBIND argument to OSI/MHS. */
/* */
/* If P-DATA or an MSUNBIND argument are to be sent, the */
/* function assumes that an association already exists. */
/* */
/***************************************************************************/
void
sendData ( char *buffer, /* Received data */
int connection, /* Connection to send data on */
int dataType)
{
long int dataLen; /* Length of received data */