I-O-CONTROL Paragraph [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
I-O-CONTROL Paragraph
The I-O-CONTROL paragraph is an optional paragraph that specifies the
areas of memory (buffers) to be shared by different files and the
locations of files on a multi-file tape reel.
Syntax
This paragraph has the following format:
SAME Clause
The SAME clause has three formats, whose meanings and restrictions are
described below.
Syntax.
SAME AREA Clause.
The SAME AREA clause allows you to conserve main memory space by
permitting two or more non-sort or non-merge files to use the same area
of main memory for processing the file.
Because the area shared includes all storage areas assigned to the files
specified, only one file can be open at any given time.
Also, a file name can appear in only one SAME AREA clause within a
program. However, this does not exclude the possibility of the file name
appearing in a SAME RECORD AREA, SAME SORT AREA, or SAME SORT-MERGE AREA
clause.
The restrictions on file names appearing in more than one SAME RECORD,
SAME SORT AREA, or SAME SORT-MERGE AREA are listed on the following pages
under the headings SAME RECORD AREA clause, SAME SORT AREA, and SAME
SORT-MERGE AREA clauses.
The files referenced in the SAME AREA clause need not all have the same
organization or access.
An external file can not be referenced in a SAME AREA clause.
To specify that FILEA, FILEB, and FILEC share the same processing area,
enter the following:
SAME AREA FOR FILEA, FILEB, FILEC.
SAME RECORD AREA Clause.
The SAME RECORD AREA clause specifies that two or more files (of any
kind) be allowed to share the same area of main memory for processing the
current logical record.
If none of the files in this clause appears in a SAME AREA clause, then
all of the files can be open at the same time.
A logical record in this shared record area is considered a logical
record of each open output file named in the SAME RECORD AREA clause. It
is also considered a record of the most recently opened input file named
in the SAME RECORD AREA clause. This is equivalent to an implicit
redefinition of the shared area. That is, records are aligned on the
leftmost character position.
If any file appears in the SAME RECORD AREA clause and in the SAME AREA
clause, then all other files appearing in the SAME AREA clause must also
appear in the SAME RECORD AREA clause. Of course, files not named in the
SAME AREA clause can also appear in the SAME RECORD clause. Because of
this restriction, and since only one file named in a SAME AREA clause can
be open at any given time, if any file in the SAME RECORD AREA clause
also appears in a SAME AREA clause, then the rule that only one file at
one time may be open takes precedence over the rule that all files named
in the SAME RECORD AREA clause can be open at the same time.
As with files named in the SAME AREA clause, files named in the SAME
RECORD AREA clause can have different organizations and access modes.
Also, if a file name appears in a SAME RECORD AREA clause, it can not
appear in any other SAME RECORD AREA clause within the program.
External files can not appear in a SAME RECORD AREA clause.
SAME SORT AREA and SAME SORT-MERGE AREA Clauses.
The SAME SORT AREA and SAME SORT-MERGE AREA clauses are equivalent. Both
specify that the area used in main memory for sorting or merging
sort-merge files is shared.
No sort or merge file can appear in a SAME AREA clause; However, it is
not necessary for all files named in a SAME SORT AREA or SAME SORT-MERGE
AREA clause to be sort or merge files. Only one must be. Furthermore,
any sort or merge file that appears in a SAME SORT AREA or SAME
SORT-MERGE AREA clause can not appear in another SAME SORT or SAME
SORT-MERGE AREA clause within the same program.
If a non-sort or non-merge file appears in a SAME AREA clause and in one
or more SAME SORT AREA or SAME SORT-MERGE AREA clauses, then all files
named in that SAME AREA clause must appear in the SAME SORT AREA or SAME
SORT-MERGE AREA clauses.
During the execution of a SORT or MERGE statement that refers to a file
named in a SAME SORT AREA or SAME SORT-MERGE AREA clause, those files
that are not sort or merge files, but are named in the SAME SORT AREA or
SAME SORT-MERGE AREA clauses, must not be open.
The files named in a SAME SORT AREA or SAME SORT-MERGE AREA clause need
not have the same organization or access mode.
External files can not appear in a SAME SORT AREA clause or a SAME
SORT-MERGE AREA clause.
NOTE Because only one file can be OPEN at any given time, there is no
implied redefinition of the record storage area, unless the SAME
RECORD AREA clause is also used. Therefore, any access of the
record area through non-OPEN'ed file data items yields undefined
results.
MULTIPLE FILE Clause
The MULTIPLE FILE clause is an obsolete feature of the 1985 ANSI COBOL
standard.
The MULTIPLE FILE clause specifies the location of files on a multiple
file reel.
Syntax.
[MULTIPLE FILE TAPE CONTAINS {file-name-5 [POSITION integer-3]
}...]...
Description.
When the file referenced by your program shares a labeled tape with other
files, you must enter the MULTIPLE FILE clause. Regardless of the number
of files on the reel, you need specify only those used by your program.
If you specify the files in chronological order, you need only enter the
file names in the MULTIPLE FILE clause:
MULTIPLE FILE TAPE CONTAINS FILEA, FILEC, FILEF
But if you specify the files in random order, you must indicate their
positions by using the POSITION clause:
MULTIPLE FILE TAPE CONTAINS FILEC POSITION 3
FILEF POSITION 6, FILEA POSITION 1
In the second example, the first position, in relation to the beginning
of the reel, is position one.
No more than one file on the same tape device can be open at the same
time.
The files specified in this clause cannot be external files.
NOTE The MULTIPLE FILE clause applies to labeled sequential files only.
This is because of the intrinsically sequential nature of magnetic
tape devices.
MPE/iX 5.0 Documentation