But there should be a check for a maximum record size, which would allow the compiler to verify that the record buffer is wide enough for that file's records. E.g. integer-2 in "RECORD CONTAINS integer-1 TO integer-2 CHARACTERS". Leslie On 2019-02-28 04:16:49 Dave Stratford wrote: > Don't forget, a file can have multiple records all of different sizes > within it. Record definitions can all be of different sizes. From a > superficial glance, this is just a different version of the same thing. > > Not sure about opening both at the same time. If both are opened INPUT, > then it would probably work. A quick check on the Micro Focus > documentation implies that it would work there. > > If someone can point me at the source of the test, I'll try it out on MF > cobol 3.0. > > Dave > > James K. Lowden 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