COBOL Manual for TNS/E Programs (H06.03+)

Environment Division
HP COBOL Manual for TNS/E Programs520347-003
6-55
I-O-CONTROL Paragraph
SAME AREA Clause for I-O Files
The SAME AREA clause advises the compiler that two or more files that are not sort-
merge files can use the same memory area during processing. Only one of these files
can be open at any given time.
RECORD
specifies that two or more files are to use the same memory area for processing
the current logical record.
same-file
is the sd-name in the sort-merge file description entry or the fd-name in the file
description entry for the file.
The compiler ignores the advice provided by the SAME AREA clause. For information
on one way files can share memory, see the HP COBOL Fast I-O (Local Buffering).
The SAME RECORD AREA clause specifies that two or more files use the same
memory area for processing the current logical record. Ordinarily, all the files can be
open at the same time, but see the restrictions on the usage of SAME clauses.
A logical record in the SAME RECORD AREA is considered a logical record of each
opened output file whose file name appears in this SAME RECORD AREA clause and
of the most recently read input file whose file name appears in this SAME RECORD
AREA clause. This is equivalent to a redefinition of the area—records are aligned on
the leftmost character position.
More than one SAME clause can be included in a program; however, there are some
restrictions on the usage of SAME clauses:
A file name must not appear in more than one SAME AREA clause or in more than
one SAME RECORD AREA clause.
If any file names of a SAME AREA clause appear in a SAME RECORD AREA
clause, all of the file names in that SAME AREA clause must appear in the SAME
RECORD AREA clause; however, additional file names not appearing in that
SAME AREA clause can also appear in that SAME RECORD AREA clause. The
rule that only one of the files mentioned in a SAME AREA clause can be open at
any given time takes precedence over the rule that all files mentioned in a SAME
RECORD AREA clause can be open at any given time.
AREARECORD FOR
SAME
same-file
VST062.vsd