In this procedure, the new lines for insertion are inserted between two existing lines without overwriting any existing lines. The procedure first attempts to insert the new lines on the basis of the current increment. If it is not possible to insert the new lines in this way, the increment used for line insertion is repeatedly divided by 10 until it is possible to insert the lines or the smallest possible increment of 0.0001
has been reached.
If it is still not possible to insert the new lines in full at the smallest possible increment of 0.0001
then the insertion procedure is interrupted with an error message if the @PAR RENUMBER=OFF statement has previously been used to deactivate automatic line renumbering.
If, however, automatic line renumbering is active (@PAR RENUMBER=ON), then the procedure attempts to renumber the larger of the two line numbers between which insertion is to be performed and any other line numbers following this in such a way that the insertion operation can be completed successfully.
Only if it is not possible to renumber sufficient lines is the insertion operation interrupted with an error message. When EDT starts, the setting @PAR RENUMBER=ON always applies for all work files. However, the setting can be modified individually for each work file.
The insertion operation is described in rather more detail below.
In this insertion procedure, it is always necessary to have two line numbers between which the new lines are to be inserted. One of the two line numbers is predefined
(in some cases implicitly) by the corresponding statement. In the case of statement codes in F mode this may be, for example, the line number of the line in which the statement code was entered, thus in the case of the @XCOPY statement, for example, the line number of what was previously the last line in the work file.
In most cases, insertion is performed after this explicitly or implicitly specified line number. The line number of the next line is then used as the second line number. If insertion is performed after the last line in the work file then the value 10000.0000
is used as the fictitious line number for the second line.
Only in the case of the statement codes B,I,1..9
and the @COPY statement (format 1) with the BEFORE
parameter specified is insertion performed before the predefined line. In this case, the line number of the preceding line is used as the second line number.
If insertion is performed before the first line then the value 0.0000
is assumed for the second line. If the work file is empty then 0.0000
is assumed for the first line number and 10000.0000
for the second line number.
In this case, the fictitious line number 0.0000
is used to determine the line number of the first line that is to be inserted (= 0.0000
+ increment) and cannot be occupied itself.
Insertion without automatic renumbering (@PAR RENUMBER=OFF)
The current increment is used as the increment for the first insertion attempt. The line number of the first line for insertion is obtained by adding the increment to the smaller of the two line numbers between which insertion is to be performed. The line numbers of the following lines for insertion are obtained by continuing to add the increment to each new value calculated. If the lines numbered in this way fit between the two starting lines then this numbering is used.
However, if they do not fit then the subsequent procedure depends on whether or not the increment is equal to its smallest possible value of 0.0001
.
If it is equal to 0.0001
then the insertion of lines is rejected with the message EDT5365
. If the increment is greater than 0.0001
then it is used to calculate a new increment by dividing the preceding increment by 10 (the current increment is not modified!). If this new increment is smaller than 0.0001
, then 0.0001
is used as the new increment.
This new increment is then used for a new insertion attempt. If the lines for insertion can be inserted using this new increment then the operation is complete.
However, if the increment is already 0.0001
then the insertion operation is rejected with the message EDT5365
. If the increment is still greater than 0.0001
, then it is again divided by 10 and a new attempt is made with this new increment.
The current line number only changes if at least one new line is created with a line number greater than the previous highest line number and is then equal to the line number of the last line in the work file plus the current increment (this is only possible when a line is inserted after the previous last line).
Insertion with automatic renumbering (@PAR RENUMBER=ON)
In this case, a two-stage procedure is used in order to maintain maximum compatibility with EDT V16.6B.
Exactly the same procedure is used as for @PAR RENUMBER=OFF.
If the increment has reached the value 0.01
and the lines can still not be inserted then an attempt is made to renumber all the existing lines which would be overwritten by the newly inserted lines in such a way that they can be appended at the last line inserted so far with an increment of 0.01
. This is the procedure used in EDT V16.6B or in compatibility mode. If it proves impossible to renumber sufficient lines in this way, EDT V16.6B or the compatibility mode interrupts the insertion operation with an error message.
In contrast, Unicode mode attempts to further reduce the increment (i.e. division by 10) down to the smallest increment value of 0.0001
in order to insert the lines.
Once the smallest possible increment of 0.0001
has been reached, the lines are always inserted with this increment of 0.0001
. All the existing lines which would be overwritten by the newly inserted lines are now renumbered in such a way that they are appended to the previous last inserted line using an increment of 0.0001
.
If this renumbering again overwrites existing lines then the operation is repeated, i.e. these lines are also renumbered. If the renumbering operation does not overwrite any more existing lines then the insertion/renumbering procedure has been completed.
Here again, the current line number only changes if at least one new line is created with a line number greater than the previous highest line number and is then equal to the line number of the last line in the work file plus the current increment.
The statement code O
represents an exception here.
When this statement code is issued, only existing lines are overwritten starting with the line indicated by O
. If all the lines following the line indicated by O
have already been overwritten and there are still lines present for insertion then these lines are inserted after the last overwritten line in accordance with the procedure described above.
The following table indicates the EDT statements for which this procedure is used (in the case of some EDT statements, other insertion procedures may be used in the event of a different format or different operands). Statements which do not start with an EDT statement symbol are statement codes.
Statement | Comments on operands | General comments |
A | ||
B | ||
I | ||
1..9 | ||
O | See above for differences from | |
T | ||
@COMPARE | The work file is deleted before use | |
@COPY | Read in SAM files, POSIX files and
| If neither the |
@FSTAT | Without target specification on | The work file |
@OPEN | OPEN SAM files, POSIX files and
| The work file must be empty before |
@SDFTEST | ||
@SEPARATE | ||
@SHOW | Without target specification on | The work file |
@STAJV | Without target specification on | The work file |
@XCOPY | If the work file is not empty, insertion
| |
@XOPEN | The work file must be empty before |