Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

@OPEN (format 2) - Real processing of an ISAM file

&pagelevel(3)&pagelevel

@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
to the SDF data type <filename 1..54>.

Here, the symbolic name '/' for a file for which the file link name EDTSAM
or EDTISAM has been assigned by means of the SET-FILE-LINK command
is not permitted.

If no file with this name exists and the AS operand is not present then an
ISAM file is created and opened. If the AS operand is present then the
statement is rejected with the message EDT4971.

If the file is a SAM file and the operand AS is not present then the message
EDT4934 is output.

If the file1 operand is not present then the file that has been preset
globally with @FILE is opened or copied. If there is no such default setting
then the @OPEN statement is rejected with the message EDT5484.

ver

Version number of the file. If an incorrect version number is specified for an
existing file then the statement is rejected with EDT4985. If the file that is to
be opened does not exist then this specification is ignored.

KEY

Only effective if a SAM file is copied to an ISAM file which is then opened
for real processing. The first 8 characters of each record in the SAM file then
form the key of the ISAM file and are to be interpreted as a line number and
not as a record content after being read in. This type of record can be
created by specifying @WRITE together with the KEY operand.

If file1 is an ISAM file then the KEY operand is ignored.

AS ...

The file file1 is copied to an ISAM file. If the copy operation is successful
then the copy is opened for real processing.

file2

Name of the ISAM file to which file1 is copied and which is then opened.
Here, the symbolic name '/' for a file for which the file link name EDTSAM
or EDTISAM has been assigned by means of the SET-FILE-LINK command
is not permitted.
If no file with this name exists then an ISAM file is created before the copy
operation.

If the file file2 already exists and the operand OVERWRITE has not been
specified then the following query is issued in interactive mode:

% EDT0296 OVERWRITE FILE? REPLY (Y=YES; N=NO)?

The file file2 is only overwritten and opened if the user responds Y. In
batch mode, the file is overwritten and opened.

The file names file1 and file2 must not be identical as otherwise the
statement is rejected with the message EDT5489.

OVERWRITESuppresses 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.