COPY [num1 [num2] [wfname]] CO
The command COPY copies one or more records behind the record of the current line in the workfile. The records to be copied are specified by their number or a symbolic number.
The number of a record may be specified without the leading zeros. Symbolic record numbers resp. line numbers are:
If that is not the case, you receive the message
First number larger than second
Number ... not found
You also have to mind that the
target area of the COPY command is not within the
area to be copied. To be precise, the target area of the copy command is
the place between the current and the following record.
The area to be copied must not contain the current line and the
line following the current line.
This would be the case if the command was
COPY * num2
and num2 was behind
the current line.
If you do not comply to these restrictions, you will receive the
message
Target in COPY area
Some examples:
co * | doubles the current line. | |
co b | copies the last line. | |
co f l | copies all data behind the current line (only possible if the current line is the last line or the top line). | |
co500* | copies from line 500 to the current line. | |
co p * | copies from the line before the current to the current line, i.e. doubles two records at the place of the current line; that is, changes the 2 lines a b to the 4 lines a b a b, if b was the current line. |
Workfile not found
For example, the command
copy 1000 1500 abc
copies the records with the numbers 1000 to 1500 from the workfile abc behind the current line of the active workfile.
Another example: You want the complete content of the
main workfile (main
) in a new workfile
named abc. The easiest solution is to use
wf abc;co f l main
Please, note that COPY T B copies the top line as well, which will not be desirable in most cases.
When specifying the workfile name, you have to specify the second parameter (the second number) (even if it is identical with the first one) if the workfile name might be mixed up with a symbolic line number. For example:
co 500 a
copies the record with the number 500 from the workfile a, while
co 500b
refers to all the records in the active workfile from number 500 onward, so that you have to write
co500 500b
if you want to copy the record 500 from the workfile b.
The copied records receive numbers that match with the existing numbers of the two records, in which the copied ones have been inserted. Since the method for the definition of the new numbers is the same for other commands, it is described only once in section Inserting Record Numbers.