There are many examples of sys.read_file() in the tutorial application.
Some of them are listed below.
/* from global PCL cm_read */
cm_code = cmcode;
if (sys.read_file(cust_mstr,F_LOOKUP|F_NOMSG) < 0) {
if (cm_code == "")
return(1); /* Return 1 for null cmcode */
return(-1);
}
return(0);
/* from op.call.de.sel addcall() */
while (1) {
if (sys.read_file(call_hdr,F_ADD|F_NOMSG|F_NODEBLOCK) < 0) {
if (sys.errno == 3) { /* Rcd Already Exists */
ch_num += 1; /* Try for next */
continue;
}
/* Different error - msg and exit PCL */
sys.err_msg("Error Trying to Add - TRY AGAIN");
return;
}
break;
}