int idxread (unit *ftnunit) { register int i; register char *keyval, *field; int newkeyid = 0, mode = ftnunit->f77idxlist.cimatch; keys = ftnunit->ukeys; ftnunit->f77recend = i = ftnunit->url; if (ftnunit->url > ftnunit->f77fio_size) check_buflen (ftnunit, ftnunit->url); while (i-- > 0) ftnunit->f77fio_buf[i] = '\0'; if (ftnunit->f77idxlist.cikeyid >= 0 && ftnunit->ukeyid != ftnunit->f77idxlist.cikeyid) { ftnunit->ukeyid = ftnunit->f77idxlist.cikeyid; newkeyid = 1; } /* 8/23/89 fix bug 4847 */ else if (ftnunit->ukeyid < 0) { ftnunit->ukeyid = ftnunit->f77idxlist.cikeyid >= 0 ? ftnunit->f77idxlist.cikeyid : 0; newkeyid = 1; } if (mode) { field = ftnunit->f77fio_buf + KEYOFF (ftnunit->ukeyid); if (KEYTYPE (ftnunit->ukeyid) != ftnunit->f77idxlist.cikeytype) err (ftnunit->f77errlist.cierr, 154, "indexed read"); if (KEYTYPE (ftnunit->ukeyid) == CHARTYPE) { keyval = ftnunit->f77idxlist.cikeyval.cicharval; /* fix bug 4779 */ if ((i = ftnunit->f77idxlist.cikeyvallen) > KEYLEN (ftnunit->ukeyid)) err (ftnunit->f77errlist.cierr, 155, "indexed read"); /* For Fortran, there's no such thing as null terminators for the string values, so use the string len value only while (*keyval && i-- > 0) *field++ = *keyval++; while (i-- > 0) *field++ = ' '; */ while (i-- > 0) *field++ = *keyval++; } else stlong (ftnunit->f77idxlist.cikeyval.ciintval, field); } else /* If the last read operation was locked try readign the same record again mode = (newkeyid ? ISFIRST : ISNEXT); */ mode = (newkeyid ? ISFIRST : ftnunit->uerror == F_ERLOCKED ? ISCURR : ISNEXT); ftnunit->uerror = 0; /* clear error for new operation */ if (newkeyid) { dokey (ftnunit->ukeyid, ONEKEY); if (isstart (ftnunit->isfd, &onekey, ftnunit->url, ftnunit->f77fio_buf, mode) < SUCCESS) ierr (ftnunit->f77errlist.cierr, iserrno, "indexed read"); } if (isread (ftnunit->isfd, ftnunit->f77fio_buf, mode) < SUCCESS) if (iserrno == EENDFILE) { ftnunit->uend = 1; err (ftnunit->f77errlist.ciend, EOF, "indexed read"); } else ierr (ftnunit->f77errlist.cierr, iserrno, "indexed read"); /* When the read is successful, make sure the EOF flag is not set */ ftnunit->uend = 0; return SUCCESS; }
int iswrite(const char UUFAR *data, unsigned int len) { unsigned int i; union REGS xmtregs; ShowModem(); /*--------------------------------------------------------------------*/ /* For an INT14 interface, just spit the data bytes out one */ /* at a time. */ /*--------------------------------------------------------------------*/ xmtregs.h.ah = FS_XMIT1; xmtregs.x.dx = portNum; /* Port number */ xmtregs.x.bx = 0; for (i = 0; i < len; i++) { union REGS outregs; xmtregs.h.al = (unsigned char) data[i]; int86(0x14, &xmtregs, &outregs); #if 1 /* Richard H. Gumpertz ([email protected]), 29 September 1993 */ if (((outregs.h.ah & 0x61) == 0x01) && (commBufferUsed < commBufferLength)) isread(NULL, commBufferLength, 0); /* do some read ahead */ #endif /* RHG */ } traceData( data, len, KWTrue ); /*--------------------------------------------------------------------*/ /* Return byte count transmitted to caller */ /*--------------------------------------------------------------------*/ return len; } /* iswrite */
int main (int iArgc, char **ppcArgv) { int iResult, iLoop, iLoop2, iLoop3, iHandle; unsigned char cRecord [256]; struct keydesc sKeydesc; char cLogfileName [100], cCommand [100]; char cFileName [] = "IsamTest"; memset (&sKeydesc, 0, sizeof (sKeydesc)); sKeydesc.k_flags = COMPRESS; sKeydesc.k_nparts = 1; sKeydesc.k_start = 0; sKeydesc.k_leng = 2; sKeydesc.k_type = CHARTYPE; if (iArgc == 1) { printf ("Usage:\n\t%s create\nOR\n\t%s <#iterations>\n", ppcArgv [0], ppcArgv [0]); exit (1); } if (iArgc > 1 && strcmp (ppcArgv [1], "create") == 0) { iserase (cFileName); iHandle = isbuild (cFileName, 255, &sKeydesc, ISINOUT+ISFIXLEN+ISEXCLLOCK); if (iHandle < 0) { printf ("Error creating database: %d\n", iserrno); exit (-1); } sKeydesc.k_flags |= ISDUPS; sKeydesc.k_start = 3; sKeydesc.k_leng = 4; for (sKeydesc.k_start = 1; sKeydesc.k_start < 2; sKeydesc.k_start++) { if (isaddindex (iHandle, &sKeydesc)) { printf ("Error %d adding index %d\n", iserrno, sKeydesc.k_start); } } isclose (iHandle); sprintf (cLogfileName, "RECOVER"); #ifdef _WIN32 sprintf (cCommand, "del /f /q %s", cLogfileName); #else sprintf (cCommand, "rm -f %s; touch %s", cLogfileName, cLogfileName); #endif system (cCommand); return (0); } sprintf (cLogfileName, "RECOVER"); #ifdef _WIN32 iResult = open("RECOVER", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0666); #else iResult = open("RECOVER", O_CREAT | O_TRUNC | O_RDWR, 0666); #endif close(iResult); iResult = islogopen (cLogfileName); if (iResult < 0) { printf ("Error opening log: %d\n", iserrno); exit (-1); } /* srand (time (NULL)); */ srand (9); for (iLoop = 0; iLoop < atoi (ppcArgv [1]); iLoop++) { if (!(iLoop % 100)) { printf ("iLoop=%d\n", iLoop); fflush(stdout); } iVBDlCount = 0; iVBRdCount = 0; iVBUpCount = 0; iVBWrCount = 0; iResult = isbegin (); if (iResult < 0) { printf ("Error begin transaction: %d\n", iserrno); exit (-1); } iHandle = isopen (cFileName, ISINOUT+ISFIXLEN+ISTRANS+ISAUTOLOCK); if (iHandle < 0) { printf ("Error opening database: %d\n", iserrno); exit (-1); } for (iLoop2 = 0; iLoop2 < 100; iLoop2++) { for (iLoop3 = 0; iLoop3 < 256; iLoop3++) { cRecord [iLoop3] = rand () % 256; } iResult =rand () % 4; /* fprintf(stderr, "I %d\n", iResult); */ switch (iResult) { case 0: if ((iResult = iswrite (iHandle, (char *) cRecord)) != 0) { if (iserrno != EDUPL && iserrno != ELOCKED) { printf ("Error writing: %d\n", iserrno); goto err; } } else { iVBWrCount++; } break; case 1: if ((iResult = isread (iHandle, (char *)cRecord, ISEQUAL)) != 0) { if (iserrno == ELOCKED) { ; /* printf ("Locked during deletion\n"); */ } else if (iserrno != ENOREC) { printf ("Error reading: %d\n", iserrno); goto err; } } else { iVBRdCount++; } break; case 2: for (iLoop3 = 0; iLoop3 < 256; iLoop3++) { cRecord [iLoop3] = rand () % 256; } if ((iResult = isrewrite (iHandle, (char *)cRecord)) != 0) { if (iserrno == ELOCKED) { ; /* printf ("Locked during rewrite\n"); */ } else if (iserrno != ENOREC) { printf ("Error rewriting: %d\n", iserrno); goto err; } } else { iVBUpCount++; } break; case 3: if ((iResult = isdelete (iHandle, (char *)cRecord)) != 0) { if (iserrno == ELOCKED) { ; /* printf ("Locked during deletion\n"); */ } else if (iserrno != ENOREC) { printf ("Error deleting: %d\n", iserrno); goto err; } } else iVBDlCount++; break; } } iResult = isflush (iHandle); if (iResult < 0) { printf ("Error flush: %d\n", iserrno); exit (-1); } iResult = isclose (iHandle); if (iResult < 0) { printf ("Error closing database: %d\n", iserrno); exit (-1); } iVBDlTotal += iVBDlCount; iVBRdTotal += iVBRdCount; iVBUpTotal += iVBUpCount; iVBWrTotal += iVBWrCount; switch (rand () % 2) { case 0: iVBDlCommit += iVBDlCount; iVBRdCommit += iVBRdCount; iVBUpCommit += iVBUpCount; iVBWrCommit += iVBWrCount; iResult = iscommit (); if (iResult < 0) { printf ("Error commit: %d\n", iserrno); exit (-1); } break; case 1: iResult = isrollback (); if (iResult < 0) { if (iserrno == EDUPL || iserrno == ENOREC) { printf ("Same BUG (%d) as in C-ISAM!\n", iserrno); } else { printf ("Error rollback: %d\n", iserrno); exit (-1); } } break; } } err: printf (" Total Commited\n"); printf (" -------- --------\n"); printf ("Delete Count: %8d %8d\n", iVBDlTotal, iVBDlCommit); printf ("Read Count: %8d %8d\n", iVBRdTotal, iVBRdCommit); printf ("Update Count: %8d %8d\n", iVBUpTotal, iVBUpCommit); printf ("Write Count: %8d %8d\n", iVBWrTotal, iVBWrCommit); printf (" -------- --------\n"); printf ("OPS OVERALL : %8d %8d\n", (iVBDlTotal + iVBRdTotal + iVBUpTotal + iVBWrTotal), (iVBDlCommit + iVBRdCommit + iVBUpCommit + iVBWrCommit)); printf (" ========\n"); printf ("ROWS ADDED THIS RUN: %8d\n", (iVBWrCommit - iVBDlCommit)); printf (" ========\n"); return (iResult); }
/* // // ISAM - Emulate START function for LT and LTEQ conditionals // Use the inverse start condition and the work backwards // */ int tcob_start_lesscond_idx(struct file_desc *f, int cond, int ikey, struct fld_desc *recfdesc, char *key_ptr) { int iresult, sresult, cmode, startpos, poslen, searchflag, r=0; tcb_fileio_vbidx_handle *h; tcob_file_key *k; char *crecord; struct keydesc *wkeydesc; #ifdef DEBUG_FILEISAM_RTS5 fprintf(stderr, "debug : tcob_start_lesscond_idx 120.020 : \n"); #endif h = (tcb_fileio_vbidx_handle *)f->dbp; k = f->keys + ikey; crecord = h->buf->buf[0]; startpos = k->offset; poslen = recfdesc->len; memset (crecord, ' ', f->reclen); memcpy (crecord+startpos, key_ptr, poslen); /* Process LTEQ conditional */ if (cond == TCB_CONDITIONAL_LTEQ) cmode = ISGREAT; /* Process LT conditional */ else cmode = ISGTEQ; /* Set the initial lower boundary */ wkeydesc = h->skeydesc + ikey; iresult = isstart(h->ifilehandle, wkeydesc, poslen, crecord, cmode); if (iresult != 0) { cmode = ISLAST; iresult = isstart(h->ifilehandle, wkeydesc, poslen, crecord, cmode); if (iresult != 0) return (23); } #ifdef DEBUG_FILEISAM_RTS5 { int i, ilen=poslen; char *pt; fprintf(stderr, "debug : tcob_start_lesscond_idx 120.060 : keyidx=%d, rec=", ikey); pt=crecord+startpos; for (i=0; i<ilen; i++) { fprintf(stderr, "%c", pt[i]); } fprintf(stderr, "; key="); pt=key_ptr; for (i=0; i<ilen; i++) { fprintf(stderr, "%c", pt[i]); } fprintf(stderr, ";\n"); } #endif /* Read previous record to set new lower boundary */ //iresult = isread(h->ifilehandle, crecord, ISPREV); iresult = isread(h->ifilehandle, crecord, ISCURR); if (iresult != 0) return (23); /* Compare keys to check conditional */ /* Loop and check for boundary condition */ searchflag = 0; while (searchflag == 0) { #ifdef DEBUG_FILEISAM_RTS5 { int i, ilen=poslen; char *pt; fprintf(stderr, "debug : tcob_start_lesscond_idx 120.100 : keyidx=%d, rec=", ikey); pt=crecord+startpos; for (i=0; i<ilen; i++) { fprintf(stderr, "%c", pt[i]); } fprintf(stderr, "; key="); pt=key_ptr; for (i=0; i<ilen; i++) { fprintf(stderr, "%c", pt[i]); } fprintf(stderr, ";\n"); } #endif /* Compare keys to check conditional */ sresult = strncmp(crecord+startpos, key_ptr, poslen); #ifdef DEBUG_FILEISAM_RTS5 fprintf(stderr, "debug : tcob_start_lesscond_idx 120.140 : sresult=%d\n", sresult); #endif if (( (sresult < 0) && (cond == TCB_CONDITIONAL_LT)) || ( (!(sresult > 0)) && (cond == TCB_CONDITIONAL_LTEQ)) ) { searchflag = 1; break; } /* Read previous record to set new lower boundary */ iresult = isread(h->ifilehandle, crecord, ISPREV); if (iresult != 0) return (23); } f->flags.start_record = 1; #ifdef DEBUG_FILEISAM_RTS5 fprintf(stderr, "debug : tcob_start_lesscond_idx 120.190 : r=%d\n", r); #endif return r; }
/* // // ISAM delete // */ int tcob_delete_idx(struct file_desc *f) { int iresult, r=0; long drecnum; tcb_fileio_vbidx_handle *h; tcob_file_key *k; char *crecord; /*struct keydesc *wkeydesc; */ #ifdef DEBUG_FILEISAM_RTS6 fprintf(stderr, "debug : tcob_delete_idx 110.020 : \n"); #endif /* ERROR check : File is open */ if (f->dbp == NULL) RETURN_STATUS(49); /* ERROR check : Record length is valid - unknown error */ if (f->reclen == -1) RETURN_STATUS(99); /* ERROR check : Must be in IO mode */ if (f->open_mode != TCB_FILE_OPEN_MODE_IO) RETURN_STATUS(49); /* Error check : If access mode is SEQUENTIAL the read done flag must be set to TRUE */ if ((f->access_mode == TCB_FILE_ACCESS_MODE_SEQUENTIAL) && (f->flags.read_done == 0)) RETURN_STATUS(39); h = (tcb_fileio_vbidx_handle *)f->dbp; k = f->keys; crecord = h->buf->buf[0]; /* Use record number to delete as defined in READ // If access mode is SEQUENTIAL and read flag is TRUE then use PREVIOUS READ as KEY // If access mode is DYNAMIC or RANDOM then use primary KEY as defined in record //if (f->access_mode != TCB_FILE_ACCESS_MODE_SEQUENTIAL) { // memset (crecord, ' ', f->reclen); // memcpy (crecord, record+k->offset, k->key_desc->len); //} */ #ifdef DEBUG_FILEISAM_RTS6 fprintf(stderr, "debug : tcob_delete_idx 110.060 : f->reclen=%d;\n", f->reclen); if (f->reclen > 0) { int i, ilen=f->reclen; char *pt = record; fprintf(stderr, "debug : tcob_delete_idx 110.065 : record="); for (i=0; i<ilen; i++) { fprintf(stderr, "%c", *(pt + i)); } fprintf(stderr, ";\n"); } #endif #ifdef DEBUG_FILEISAM_RTS6 fprintf(stderr, "debug : tcob_delete_idx 110.090 : isrecnum=%d;\n", isrecnum); #endif /* Save record number to be deleted */ drecnum = isrecnum; /* Read NEXT or PREVIOUS record to set current record */ f->flags.read_next_done = 1; iresult = isread(h->ifilehandle, crecord, ISNEXT); #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_delete_idx 110.095 : iresult=%d, isrecnum=%d;\n", iresult, isrecnum); #endif if (iresult != 0) { iresult = isread(h->ifilehandle, crecord, ISPREV); f->flags.read_next_done = 0; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_delete_idx 110.098 : iresult=%d, isrecnum=%d;\n", iresult, isrecnum); #endif } /* Delete record using primary key - USE record number */ /* iresult = isdelete(h->ifilehandle, crecord); */ /* Delete record using record number */ iresult = isdelrec(h->ifilehandle, drecnum); #ifdef DEBUG_FILEISAM_RTS6 fprintf(stderr, "debug : tcob_delete_idx 110.100 : iresult=%d, isrecnum=%d;\n", iresult, isrecnum); #endif /* Set return code depending on VB iserrno */ if (iresult != 0) r = tcob_eisam2ecob(0); /* Reset flags */ f->flags.read_done = 0; f->flags.init_done = 0; f->flags.start_record = 0; #ifdef DEBUG_FILEISAM_RTS6 fprintf(stderr, "debug : tcob_delete_idx 110.120 : r=%d;\n", r); #endif RETURN_STATUS(r); }
/* // // ISAM read NEXT - PREVIOUS // */ int tcob_read_next_idx(struct file_desc *f, struct fld_desc *rectofrom_desc, char *rectofrom_buf, int nflag, struct fld_desc *reclen_desc, char *reclen_buf) { int iresult, r=0, imode, reclen; tcb_fileio_vbidx_handle *h; tcob_file_key *k; char *crecord; /* ERROR check : File is open */ if (f->dbp == NULL) { /* ERROR check : Set file-status condition when file is not available */ if (f->flags.optional && f->flags.file_missing) RETURN_STATUS(10); RETURN_STATUS(47); } #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.020 : filename=%s, reclen=%d;\n", f->filename, f->reclen); #endif f->flags.read_done = 0; /* ERROR check : Record length is valid - unknown error */ if (f->reclen == -1) RETURN_STATUS(99); /* ERROR check : Must be in INPUT or IO mode */ if ((f->open_mode != TCB_FILE_OPEN_MODE_INPUT) && (f->open_mode != TCB_FILE_OPEN_MODE_IO)) RETURN_STATUS(47); /* Check that we didn't already hit eof */ if ((f->open_mode == TCB_FILE_OPEN_MODE_INPUT || f->open_mode == TCB_FILE_OPEN_MODE_IO) && (f->flags.eof_hit) ) RETURN_STATUS(46); /* ERROR check : For sequential READ access mode must be SEQUENTIAL or DYNAMIC */ if ((f->access_mode != TCB_FILE_ACCESS_MODE_SEQUENTIAL) && (f->access_mode != TCB_FILE_ACCESS_MODE_DYNAMIC) ) RETURN_STATUS(39); h = (tcb_fileio_vbidx_handle *)f->dbp; k = f->keys; crecord = h->buf->buf[0]; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.040 : isrecnum=%d;\n", isrecnum); #endif /* If there is a start record outstanding set current record for read */ if ((f->flags.start_record == 1) || (f->flags.read_next_done == 1)) { imode = ISCURR; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.060 : imode(ISCURR)=%d;\n", imode); #endif } else { //memcpy (crecord, record, f->reclen); /* Set record position for read */ if (nflag == TCB_FILE_READ_REC_PREVIOUS) { imode = ISPREV; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.062 : imode(ISPREV)=%d;\n", imode); #endif } else { imode = ISNEXT; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.064 : imode(ISNEXT)=%d;\n", imode); #endif } } f->flags.start_record = 0; f->flags.read_next_done = 0; /* Read record */ iresult = isread(h->ifilehandle, crecord, imode); #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.080 : iresult=%d, isrecnum=%d;\n", iresult, isrecnum); #endif /* Set return code depending on VB iserrno */ if (iresult != 0) { r = tcob_eisam2ecob(0); RETURN_STATUS(r); } /* Variable Length File */ if (reclen_desc != NULL) { reclen = isreclen; if (reclen > f->reclen) RETURN_STATUS(99); tcob_move(&_generic_4binary, (char *)&reclen, reclen_desc, reclen_buf); } else { reclen = f->reclen; } #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.100 : reclen=%d;\n", reclen); if (reclen > 0) { int i, ilen=reclen; char *pt = crecord; fprintf(stderr, "debug : tcob_read_next_idx 080.105 : record="); for (i=0; i<ilen; i++) { fprintf(stderr, "%c", *(pt + i)); } fprintf(stderr, ";\n"); } #endif /* Clear buffer and move data record */ memset(f->record, ' ', f->reclen); memcpy (f->record, crecord, reclen); /* Copy buffer data to INTO identifiers buffer */ if (rectofrom_desc != NULL) { memset(rectofrom_buf, ' ', rectofrom_desc->len); if (rectofrom_desc->len > reclen) memcpy(rectofrom_buf, crecord, reclen); else memcpy(rectofrom_buf, crecord, rectofrom_desc->len); } f->flags.read_done = 1; #ifdef DEBUG_FILEISAM_RTS2 fprintf(stderr, "debug : tcob_read_next_idx 080.120 : r=%d;\n", r); #endif RETURN_STATUS(r); }
/* // // ISAM read // */ int tcob_read_idx(struct file_desc *f, struct fld_desc *rectofrom_desc, char *rectofrom_buf, struct fld_desc *reclen_desc, char *reclen_buf, int ikey, struct fld_desc *fkey, char *keybuf) { int iresult, r=0, reclen; tcb_fileio_vbidx_handle *h; tcob_file_key *k; char *crecord; struct keydesc *wkeydesc; #ifdef DEBUG_FILEISAM_RTS1 fprintf(stderr, "debug : tcob_read_idx 070.020 : filename=%s, reclen=%d;\n", f->filename, f->reclen); #endif f->flags.read_done = 0; f->flags.start_record = 0; /* ERROR check : File is open */ if (f->dbp == NULL) { /* ERROR check : Set file-status condition when file is not available */ if (f->flags.optional && f->flags.file_missing) RETURN_STATUS(10); RETURN_STATUS(47); } /* ERROR check : Record length is valid - unknown error */ if (f->reclen == -1) RETURN_STATUS(99); /* ERROR check : Must in INPUT or IO mode */ if (((f->open_mode != TCB_FILE_OPEN_MODE_INPUT) && (f->open_mode != TCB_FILE_OPEN_MODE_IO))) RETURN_STATUS(47); /* Check that we didn't already hit eof */ if ((f->open_mode == TCB_FILE_OPEN_MODE_INPUT || f->open_mode == TCB_FILE_OPEN_MODE_IO) && f->flags.eof_hit) RETURN_STATUS(46); /* ERROR check : For random key READ access mode must be RANDOM or DYNAMIC */ if ((f->access_mode != TCB_FILE_ACCESS_MODE_RANDOM) && (f->access_mode != TCB_FILE_ACCESS_MODE_DYNAMIC) ) RETURN_STATUS(39); /* ERROR check : Key is required - unknown compiler error */ if (fkey == NULL) RETURN_STATUS(99); /* ERROR check : Key index is within bounds */ if ((f->nkeys <= ikey) || (0 > ikey)) RETURN_STATUS(99); h = (tcb_fileio_vbidx_handle *)f->dbp; k = f->keys; crecord = h->buf->buf[0]; /* Read with key */ memset (crecord, ' ', f->reclen); k = f->keys + ikey; memcpy (crecord+k->offset, keybuf, fkey->len); wkeydesc = h->skeydesc + ikey; iresult = isstart(h->ifilehandle, wkeydesc, f->reclen, crecord, ISEQUAL); if (iresult != 0) { r = tcob_eisam2ecob(0); RETURN_STATUS(r); } iresult = isread(h->ifilehandle, crecord, ISCURR); if (iresult != 0) { r = tcob_eisam2ecob(0); RETURN_STATUS(r); } /* Variable Length File */ if (reclen_desc != NULL) { reclen = isreclen; if (reclen > f->reclen) RETURN_STATUS(99); /* Set record length buffer for variable length file */ tcob_move(&_generic_4binary, (char *)&reclen, reclen_desc, reclen_buf); } else { reclen = f->reclen; } /* Clear buffer and move data record */ memset(f->record, ' ', f->reclen); memcpy (f->record, crecord, reclen); /* Copy buffer data to INTO identifiers buffer */ if (rectofrom_desc != NULL) { memset(rectofrom_buf, ' ', rectofrom_desc->len); if (rectofrom_desc->len > reclen) memcpy(rectofrom_buf, crecord, reclen); else memcpy(rectofrom_buf, crecord, rectofrom_desc->len); } f->flags.read_done = 1; #ifdef DEBUG_FILEISAM_RTS1 fprintf(stderr, "debug : tcob_read_idx 070.140 : r=%d;\n", r); #endif RETURN_STATUS(r); }