#4 Secondary ISAM keys not always match --> 39 error (fix to check only given keys)

Test
pending
nobody
None
1
2014-02-26
2013-01-26
Ron Norman
No

I just used svn to get the latest CE version.
In libcob/fileio.c around line 1822 is the following code:

        memset(&di, 0, sizeof(di));
        isindexinfo (isfd, (void *)&di, 0);
        fh->nkeys = di.di_nkeys & 0x7F; /* Mask off ISVARLEN */
        if (fh->nkeys > f->nkeys) {
            fh = realloc (fh, sizeof(struct indexfile) + ((sizeof (struct keydesc)) * (fh->nkeys + 1)));
        }
        for (k = 0; k < fh->nkeys; k++) {

If you can change the 'for' statement to read as follows:
for (k = 0; k < f->nkeys; k++) {

Then when a programmer omits secondary index definitions they will not get the error code 39.
Often programs may want to just read the file by the primary index.
Micro Focus has an EXTFH keyword KEYCHECK=OFF to allow this same condition.
Can OC just always work like this or should it be checking some env var like COB_KEYCHECK or something like that?

Discussion

  • Simon Sobisch
    Simon Sobisch
    2014-02-26

    • status: open --> pending
     
  • Simon Sobisch
    Simon Sobisch
    2014-02-26

    Ticket moved from /p/open-cobol/bugs/46/

     
  • Simon Sobisch
    Simon Sobisch
    2014-02-26

    • summary: ISAM keys not always match --> 39 error --> Secondary ISAM keys not always match --> 39 error (fix to check only given keys)
    • Group: open --> Test