User`s guide
82 DC 900-1406E
BSCTRAN Programmer’s Guide
Caution
The RCUNR return code from BSCREAD is treated as a non-fatal
error. User applications that call this procedure should handle the
unexpected response during record processing or call BSCRESET.
The C code fragment shown below illustrates the proper use of
BSCREAD after an unexpected data response is received while
calling BSCWRIT. See also the example following the BSCWRIT
procedure in Section 4.7 on page 87. Note that the
rdblock must
be common between BSCWRIT and BSCREAD.
/* Use a common rdblock for BSCWRIT and BSCREAD */
TRANBUF rdblock; /* rdblock for ICP responses */
.
struct dsc$descriptor_s rd_recbuf; /* Read record buffer */
.
/* Open the receive file */
.
lastrec = -1; /* Tell BSCREAD that the global rdblock already */
/* contains the first block of unexpected data */
do /* Receive one record at a time until end-of-file */
{
rd_recbuf.dsc$w_length = 0; /* Clear length field */
do /* Loop until get a good record or error */
{
retcode = BSCREAD (&rdblock, &rd_recbuf, &recl, &lastrec,
&fixed, &binary, &forms, &dtime);
if (retcode == RCUNR)
{
/* Handle the unexpected response contained in the rdblock: */
/* For example, you could ignore reports and abort on */
/* fatal errors. */
}
else if (retcode != RCOK)
{
/* Abort program on fatal errors other than RCUNR */
/* (such as timeout of ‘dtime’ (RCTO error). */
}
} while (retcode == RCUNR);