next previous up contents index
Next: COUNT Previous: CONCAT Up: The Commands in Detail


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 you specify only one number in the COPY command, only this record will be copied. If you specify two numbers, all records from the first to the second number will be copied. For this purpose, it is necessary that num1 <= num2 is valid.

If that is not the case, you receive the message

If you specify a number that does not exist in your workfile, you receive the message The ... are replaced by the number in the output.

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

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.
Without the specification of a third parameter, the records are taken from the workfile where they should be inserted. It is also possible to specify a workfile as third parameter where the records should be fetched for copying. If the specified workfile does not exist, you receive the message

For example, the command

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

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:

copies the record with the number 500 from the workfile a, while

refers to all the records in the active workfile from number 500 onward, so that you have to write

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.


next previous up contents index
Next: COUNT Previous: CONCAT Up: The Commands in Detail