Erases a line or range of lines from the current routine.
command erases routine lines from the current routine. ZREMOVE
has two forms:
You can only use the ZREMOVE
command when you enter it at the programmer prompt or when you call it using an XECUTE
command. It should not be coded into the body of a routine because its operation would effect the execution of that routine.
Only the local copy of the routine is affected, not the routine as stored on disk. To store the modified code, you must use the ZSAVE
command to save the routine.
without an argument erases the entire current routine. The following Terminal session shows this operation:
with arguments erases code lines in the current routine. ZREMOVE lineref1
erases the specified line. ZREMOVE lineref1
erases the range for lines starting with the first line reference and ending with the second line reference, inclusive.
The following Terminal session shows this operation. This example uses a dummy routine (^myroutine) in which each line sets a variable to a string naming that line:
SET x="this is line 8"
SET x="this is line 9"
An optional postconditional expression. Caché executes the command if the postconditional expression is true (evaluates to a nonzero numeric value). Caché does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions
in Using Caché ObjectScript
The line to be removed, or the first in a range of lines to be removed. It can take any of the following formats:
||Specifies a line number within the routine. A positive integer, counting from 1.
||Specifies a label within the routine. ZREMOVE erases only the label line itself. This includes any code that follows the label on that line.
||Specifies a label and the number of line to offset within the labeled section, counting the label line as line 1.
A label may be longer than 31 characters, but must be unique within the first 31 characters. ZREMOVE
matches only the first 31 characters of a specified label
. Label names are case-sensitive, and may contain Unicode characters.
You can use lineref1
to specify a single line of code to remove. You specify the code line either as an offset from the beginning of the routine (+lineref1
) or as an offset from a specified label (module2+lineref1
: removes the 7th line counting from the beginning of the routine.
: performs no operation, generates no error.
: if 999 is greater than the number of lines in the routine, performs no operation, generates no error.
: removes the 999th line following label line Test1. This line may be in another labeled module. If 999 is greater than the number of lines from label Test1 to the end of the routine, performs no operation, generates no error.
are counted as code lines in a line offset. Whitespace
lines are not counted as code lines in line offset. Comments
are not counted as code lines in a line offset, with one exception. A single-line comment delimited by ;; is counted as a code line for the purposes of line offset.
The last line in a range of lines to be removed. Specify lineref2
in any of the formats used for lineref1
. The colon prefix (:) is mandatory.
This command erases the fourth line within the current routine.
This command erases the sixth line after the label Test1.
This command erases lines three through ten, inclusive, within the current routine.
This command erases the label line Test1 through the line that immediately follows it, within the current routine.
This command erases all of the line from label Test1 through label Test2, inclusive of both labels, within the current routine.