@OPEN (format 2) opens an ISAM file for processing directly on the disk. This file may already exist, may be created before being opened or be created as a copy of an existing SAM or ISAM file.
Only the section of the ISAM file that is actually required is read at any given time into the current work file. In F mode, these are the records which are fully or partially displayed on the screen. In L mode, the required records are not read in until an EDT statement is executed. The file remains open until processing is terminated by @CLOSE.
It is only possible to open ISAM files for real processing in work file 0. This must be empty or contain a file opened for real processing using @OPEN (format 2).
Operation | Operands | F mode, L mode |
@OPEN | [file1] [(ver)] [ [KEY] [AS file2 [ [,]OVERWRITE] ] |
file1 | Name of the file that is to be opened or copied. The name must correspond Here, the symbolic name If no file with this name exists and the If the file is a SAM file and the operand If the |
ver | Version number of the file. If an incorrect version number is specified for an |
KEY | Only effective if a SAM file is copied to an ISAM file which is then opened If |
AS ... | The file |
file2 | Name of the ISAM file to which If the file
The file The file names |
OVERWRITE | Suppresses the query EDT0296 if the file file2 exists. The file is overwritten and opened. If file2 does not yet exist then OVERWRITE has no effect. |
After @OPEN (format 2), the statements @RENUMBER, @SORT and @COMPARE are rejected. Records from files which have been opened for real processing cannot be marked (mark statement code, @ON, format 3) and are not automatically saved (see @AUTOSAVE).
If a file is already open for real processing then this is implicitly closed when another
@OPEN (format 2) statement is issued and the work file is deleted. Only then is the second file opened.
The line numbers in the work file are formed from the file's ISAM key when the file is read. When a SAM file is copied to an ISAM file, the ISAM keys are formed from the first 8 characters of the file if the KEY
operand has been specified. Otherwise they are formed using the procedure “Insertion at the current line number” (see section “Line number assignment”).
The work file is assigned the character set of the file that is to be read in or (if this does not yet exist) the character set defined by the current system settings. If this character set is *NONE
then the work file is assigned the character set EDF03IRV
. The character set of the work file can then not be changed until the file is closed.
If the work file already has a different character set then the statement is rejected with the message EDT5452
.
If the file link name EDTMAIN
is assigned to the ISAM file that is to be opened and if the file has been newly created then the attributes stored in the TFT are taken into account when the file is created. Otherwise, a file with default attributes is created. This does not apply if an existing ISAM file is copied and then opened. Such a file is assigned the attributes of the file that is to be copied.
Errors in the file (e.g. non-numerical keys, illegal byte sequences etc.) may sometimes not be detected until much later when the corresponding records are to be read. Not all the records in the file are read in when the file is opened. Any errors that are subsequently detected are then reported by the command which was executing when they occurred. In such cases, a file that has been opened for real processing is automatically closed.
If the ISAM file opened for real processing contains records with identical key values (duplicate keys) then it is not possible to predict how EDT will behave in all cases. Depending on the type of read operation, it is possible that either the first or the last of the records with the identical keys will be displayed. In such cases, the first record is always overwritten. If EDT identifies the occurrence of such identical key values then it terminates file processing in the same way as in the presence of other file errors, issues the message EDT5445
and closes the file that has been opened for real processing.
In an ISAM file with a short key (fewer than 8 characters) which has been opened for real processing, it is not possible to create records with line numbers that are too large to be correctly displayed as a key. Statements which cause this are aborted with the error message EDT5446
.
If the AS
operand is specified and the first file is an ISAM file then it is copied by means of an implicit COPY-FILE command. If it is a SAM file then the copy operation is implemented by means of an implicit @READ statement and an implicit @SAVE statement.
In this case, the statement can be interrupted with [K2]. If it is interrupted and the EDT session is continued with /INFORM-PROGRAM
then the processing of the statement is aborted and message EDT5501
is output.
Note
This command is suited for processing statements which are too large to be fully loaded into EDT for processing.