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: Dave Stratford
Subject: Re: [GnuCOBOL-users] select same file twice?
Date: Thu, 28 Feb 2019 10:16:49 -0000 (GMT)
User-agent: SquirrelMail/1.4.8-21.el5.centos

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


-- 
Hexagon Systems Limited                             Experts in VME solutions




reply via email to

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