The @MOVE statement transfers records from the current or another work file to the current work file and then deletes them at their original positions or transfers the contents of string variables to the current work file and then reinitializes the string variables.
For the sake of clarity, the line range in the source work file which contains the records that are to be moved or the range of string variables are referred to as the “source range” below. The line range in the current work file into which the records from the source work file are to be moved is referred to as the “target range”.
Operation | Operands | F mode, L mode |
@MOVE | { { lines [(procnr)] | svars } [TO { line1 [(inc)] [:] [line2] } [,...] ] } [,...] |
lines | Contiguous line range that is to be moved to the current work file. Symbolic |
procnr | Number of the source work file from which the records are to be moved |
svars | Range of string variables whose contents are to be moved into the current |
TO... | The operands which follow If the source work file is the current work file or if string variables are moved |
line1 inc | Number of the first line in the target range. Increment used to form the line numbers following |
: | The operands line1 and line2 should be separated by : if inc is not specified. |
line2 | Specifies the largest possible line number in the target range up to which As a result, no move operation is performed to lines in the current work file If |
In the @MOVE statement, it is possible to specify multiple comma-separated source ranges each of which are associated with multiple target ranges. The number of source and target ranges is only limited by the maximum permitted length of EDT statements. It is not usually of value to specify multiple target ranges since the lines are deleted in the source range the first time they are transferred and are therefore no longer available for further move operations.
If the source and target ranges overlap then the source range is moved and deleted lineby-line.
Any existing lines with the same line numbers present in the work file are overwritten on the move operation.
If a line with a number greater than the previous highest line number is created then the current line number is modified.
If the current work file is empty and has the character set *NONE
then it is assigned the character set of the source work file or the first specified string variable when the move operation is performed.
If the current work file has a character set then the lines to be moved or the contents of the string variables are converted into the character set of the current work file. If characters which cannot be displayed in the work file's character set are identified then these characters are replaced by a substitute character provided that such a character has been specified (see @PAR SUBSTITUTION-CHARACTER); otherwise, the @ MOVE statement is rejected and error message EDT5453
is output.
If the statement is interrupted with [K2] and the EDT session is continued with /INFORM-PROGRAM
then the processing of the statement is aborted and message EDT5501
is output.
Note
Since the above syntax permits the omission of the TO
operand, it is not always possible to distinguish unambiguously between the target and source ranges. In such cases, EDT interprets the ambiguous specification as a target range. Thus, for example, in the input
@MOVE 2-3(1) TO 7,1(1)
the specification 1(1)
is interpreted as a second target range (the 1
in parentheses is interpreted as the increment), whereas the specification 1(0)
at this point would be interpreted as the next source range (the 0
cannot be an increment and is interpreted as a work file number). If, in this example, the user wants to force the specification to be interpreted as a source range, it would be possible, for example, to enter
@MOVE 2-3(1) TO 7,1-1(1)
to eliminate all ambiguities.
Example
Lines 2 to 4 are to be moved to the line range starting at line 20. The value 1 is specified implicitly as the increment for the target range.
Lines 20, 21 and 22 have now been created with the implicit increment 1 and lines 2, 3 and 4 have been deleted.
Lines 20-22 are to be copied to 100, 105 and 110.
The line range from line 100 through to the end of the work file (100-.$
) is to be copied to the line range starting at line 82 with the explicit increment 5. Since 89 has been specified as the highest possible line number for the target range, line 90 is not written.
Since 89 has been specified as the highest possible line number for the target range, line 110 is not transferred.