|
From: | Ron Norman |
Subject: | Re: [GnuCOBOL-users] select same file twice? |
Date: | Wed, 27 Feb 2019 12:10:58 -0800 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |