When finished with a batch, call DoBatch() with a mode of BAT_CAN. Use this to cancel a batch before you have processed all records. It is also a good idea to make this call even if you have processed all of the records. There are some cases where DoBatch() will close the batch automatically. However, this doesn’t always happen. For instance, if you do not specify either BAT_REC_RET or BAT_RET_POS, so that the only effect is for the PKEYREQ structure to be updated, DoBatch() does NOT automatically close the batch. If you try to make another call of that same sort, you will see error BTST_ERR (427).
Therefore, we recommend that you always make a DoBatch() call with a mode of BAT_CAN to end a sequence of batch calls.
See also:
Signal Batch Clean-up on Client Side
It was found that redundant calls to BATSETX()/BATSET() with a mode of BAT_CAN could be eliminated for convenience and notify a client when a batch request has been completed.
This feature causes sysiocod to be set to BTNO_COD (-844) on calls to BATSETX()/BATSET() that result in the current batch being closed. If the client application finds sysiocod set to BTNO_COD, then the application does not need to issue a BAT_CAN call before issuing a new batch request.
This new behavior requires the following FairCom Server configuration entry:
COMPATIBILITY BATCH_SIGNAL