The LABEL assignment statement sets
or retrieves the values for the label on the specified line and places
the values in variables.
Syntax
Assignment statement syntax
>>-ISREDIT--(var1,var2)-- = --LABEL--+-label---+---------------><
'-linenum-'
>>-ISREDIT--LABEL--+-labelname-+-- = --label--+-------+--------><
'-linenum---' '-level-'
- var1
- The name of a variable to contain the name of the label.
- var2
- The name of a variable to contain the nesting level of the label.
It must be a 3-character value that is left-padded with zeros.
- label
- A
label identifying the line for which a label must be set or retrieved.
See the LOCATE and RESET command descriptions, which use labels
to specify line ranges.
- linenum
- A
relative line number identifying the line for which a label must be
set or retrieved.
Use the LINENUM assignment statement to obtain
the current relative line number of a line with a label.
- labelname
- The name of the label.
For more information about using labels,
see Labels and line ranges.
The LINENUM
assignment statement can be used to determine whether a label exists.
For more information, see LINENUM—Query the Line Number of a Labeled Line.
- level
- The highest nesting level at which this label is visible to you
or to a macro. Level 0 is the highest level. Labels at this level
are visible to you and to all levels of nested macros. Level 1 is
not visible to you, but it is visible to all macros, and so on. The
level can never exceed the current nesting level. The maximum nesting
level is 255. The level number defaults to the current nesting level.
Description
A
range of labels is particularly useful for commands that operate on
a range of lines, such as those in this list:
CHANGE EXCLUDE LOCATE SEEK
CREATE FIND REPLACE SORT
DELETE FLIP RESET SUBMIT
Return codes
- 0
- Normal completion
- 4
- Label name not returned, specified line has no label
- 8
- Label set, but an existing label at the same level was deleted
- 12
- Line number specified is beyond the end of data
- 20
- Severe error
Examples
To get the line of data at the
cursor, look for the next occurrence of the string in the variable &ARG,
and then label the line if it is found and currently unlabeled:
ISREDIT (NAME) = LINE .ZCSR
ISREDIT FIND &ARG
IF &LASTCC = 0 THEN -
ISREDIT (LBL,NEST) = LABEL .ZCSR
IF &LBL=&STR() THEN -
ISREDIT LABEL .ZCSR = .POINT 0