6100 ADCCP Programming Manual

Application Tasks
Writing Applications that Use ADCCP
4–14 069225 Tandem Computers Incorporated
The following example is a C Language function that uses WRITEREAD to make a
request. In this example, dPtr is a pointer to the the WRITEREAD buffer.
WRITEREAD is used to make the SET CONFIGURATION request and response.
void Receive(rfnum,function_code,textout,textin,length,dPtr)
short rfnum; /* IN - file number from OPEN returned from
* Open_line.
*/
short function_code; /* IN - Request number.
*/
short textout; /* IN - text out length for request.
*/
short textin; /* IN - text in length for response.
short length; /* IN - length of the WRITEREAD buffer.
* calculated in the calling function.
*/
struct message *dPtr; /* IN/OUT - Points to the structured variable
* that contains the request/response data
* for the WRITEREAD buffer.
*/
{
short c_code = 0;
short count;
short count_trans;
int error;
/*
* The values for the specific request are assigned to the
* structure for the request and the buffer length is set.
*/
dPtr->function = function_code;
dPtr->modifier = 0;
dPtr->request_id = function_code;
dPtr->text_out = textout;
dPtr->text_in = textin;
count = length;
c_code = WRITEREAD(rfnum,(short *)dPtr,length,count,&count_trans);
if (c_code != CCE) {
FILEINFO(rfnum,&error);
printf("Error %d occurred on WRITEREAD\n",error);
ABEND();
}
}