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

GC 1.x
pending
nobody
None
6
2016-12-23
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
     
  • Ron Norman

    Ron Norman - 2016-06-07

    This issue was resolved some time ago in the reportwriter branch.
    When reportwriter gets merged into 2.0 this issue will be resolved for all.

     
  • Simon Sobisch

    Simon Sobisch - 2016-12-23
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -10,6 +10,7 @@
                 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.
    
    • Group: Test --> GC 1.x
    • Priority: 1 --> 6
     
  • Simon Sobisch

    Simon Sobisch - 2016-12-23

    Leaving as pending until rw-branch is rechecked for a runtime/compiler flag.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks