gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GnuCOBOL-users] select same file twice?


From: Ron Norman
Subject: Re: [GnuCOBOL-users] select same file twice?
Date: Wed, 27 Feb 2019 12:10:58 -0800

The test case is testing that it gets status 39 due to the different record lengths.

           OPEN INPUT TSTFILE
           IF CUST-STAT NOT = "00"
               DISPLAY "Expected ERROR " CUST-STAT
                       " opening TSTFILE, Record size different "
                       UPON CONSOLE
           ELSE
               DISPLAY "Un-Expected open TSTFILE, Record size different"
                       UPON CONSOLE
               CLOSE TSTFILE
           END-IF.                                  

This works fine with C-ISAM, D-ISAM, VB-ISAM but will likely fail if you are using BDB.
If you are using BDB, just ignore the test case failure.

BDB has no concept of a record size.
If using BDB, on OPEN, the fileio.c code does a read of the first record and compares the length to what is in the COBOL code and may give you '39'


On Wed, Feb 27, 2019 at 11:57 AM James K. Lowden <address@hidden> wrote:
I believe test 0629 is invalid.  It says:

       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT OPTIONAL TSPFILE
           ASSIGN TO "testisam"
           ORGANIZATION INDEXED ACCESS DYNAMIC
           RECORD KEY IS CM-CUST-NUM
           ALTERNATE RECORD KEY IS CM-TELEPHONE WITH DUPLICATES
           ALTERNATE RECORD KEY IS CM-DISK WITH DUPLICATES
           FILE STATUS IS CUST-STAT.

           SELECT TSTFILE
           ASSIGN TO "testisam"
           ORGANIZATION INDEXED ACCESS DYNAMIC
           RECORD KEY IS TS-CUST-NUM
           ALTERNATE RECORD KEY IS TS-TELEPHONE WITH DUPLICATES
           ALTERNATE RECORD KEY IS TS-DISK WITH DUPLICATES
           FILE STATUS IS CUST-STAT.

TPSFL-RECORD is 177 bytes. 
TSTFL-RECORD is 172 bytes. 

Is this valid?  If so, how to stuff 177 bytes into a 172-byte record? 

My understanding is that in a mainframe environment, the SELECT would
be rejected before processing begins, or at least OPEN will fail. The
Cobol runtime support will recognize that the the program's supplied
record buffer doesn't match the file's record properties, and returns
an error. 

I assume it IS valid to open the same file twice. 

For the moment, our fix in indexed_file_read (in fileio.c) is to return
an error if the record size is larger than the supplied buffer.  I
think the correct fix is to fail the open, and maintain only an assert
in indexed_file_read. 

What do the COBOL mavens say? 

--jkl





--
Cheers
Ron Norman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]