COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
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.
The files mentioned in the SAME AREA or SAME RECORD AREA clause can differ in organization
or access.
SAME AREA Clause for Sort-Merge Files
The SAME AREA clause of the I-O-CONTROL paragraph can also specify sort-merge files.
HP COBOL ignores the advice provided to the compiler by the SAME AREA clause. The file system
automatically allocates and manages all memory areas needed for file processing and for sort or
merge operations.
RECORD
specifies that two or more files are to use the same memory area for processing the current
logical record.
SORT
is ignored by the compiler, but SORT specifies that the compiler can use (and re-use) the same
memory area to sort or merge each sort or merge file specified by same-file. If SORT is
specified, at least one same-file must be a sort file.
MERGE
is equivalent to SORT in the SAME AREA clause. If MERGE is specified, at least one same-file
must be a merge file.
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.
Usage Considerations:
• File Organization and Access Modes
The files specified in the SAME AREA clause can have different types of organization or
different access modes.
• 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
Input-Output Section 141










