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

Environment Division
HP COBOL Manual for TNS/E Programs520347-003
6-57
I-O-CONTROL Paragraph
SAME SORT AREA or SAME MERGE AREA Clause
If the SAME SORT AREA or SAME MERGE AREA clause is used, at least one
same-file must be a sort or merge file. Files that are not sort or merge files can
also be named.
You can include more than one SAME AREA clause in a program; however, if a file
name that is not a sort or merge file appears in a SAME AREA clause and one or
more SAME SORT AREA or SAME MERGE AREA clauses, then all of the files
named in that SAME AREA clause must also be named in each of the affected
SAME SORT AREA or SAME MERGE AREA clauses.
This clause specifies that storage be shared:
°
The SAME SORT AREA and SAME MERGE AREA clauses advise the
compiler that the same memory area can be used in sorting or merging each
sort or merge file named and that any memory area used for sorting or merging
a sort-merge file can be reused in sorting or merging any other sort-merge
files. The compiler ignores the advice provided by this clause.
°
Storage areas assigned to files that do not represent sort or merge files can be
allocated as needed for sorting or merging the sort-merge files named in the
SAME SORT AREA or SAME MERGE AREA clause.
°
Files other than sort-merge files do not share the same storage area with each
other. If you want these files to share the same storage area, you must also
include a SAME AREA or SAME RECORD AREA clause naming the files.
°
During the execution of a SORT or MERGE statement referring to a sort or
merge file named in this clause, any file named in this clause that is not a sort
or merge file must not be open.
SAME RECORD AREA Clause
The SAME RECORD AREA clause specifies that two or more files are to use
the same memory area for processing the current logical record. All of the
files can be open at the same time. 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. This is equivalent to
implicit redefinition of the area—records are aligned on the leftmost character
position.
A file name must not appear in more than one SAME RECORD AREA clause.