Using line labels and line ranges
Labels are used with primary commands to identify a line or a range of lines.
Line Labels
Line labels are a primary method of referencing back to the location of a line in the data set. For character and vertical formatted mode, a line label is specified as a period followed by a one- to five-digit alphanumeric string (.label) typed in a sequence number field. For all modes, the label is entered in the COMMAND field (see also LABEL).
You can also use the following File-AID-defined labels:
- .ZF -- First line of the file
- .ZFIRST -- First line of the file
- .ZL -- Last line of the file
- .ZLAST -- Last line of the file
- .ZCSR -- Cursor line.
A label cannot be assigned to a nondata line or to a line indicating exclusion from the display. To reassign a label, type it on a new line. To eliminate a label, type blanks over it. Use the RESET command with the LAB keyword to eliminate all labels.
Line Ranges
Pairs of line labels define a line range by specifying the first and last lines, inclusively. To process a single line, either repeat the label as both the first and last line of the range, or enter a single label.
Line ranges are always specified as optional parameters. To specify a line that does not have a defined label, specify the line number preceded by a period ( . ). For example, type .123 to refer to line number 123. The first line of a file can be referenced by label .0 or .1 and the last line of the file can be referenced by label .999999. In this case, the label may exceed the maximum of six characters.
The following rules apply to line ranges:
- Labels must be assigned to the first and last lines of a range unless the actual line numbers are used.
- Both the starting and ending labels must be specified in the command to identify a range of lines.
- As long as both labels are given, their order is not significant. The line closest to the first line of the data set is interpreted as the first line of the range. The line closest to the last line of the data set is interpreted as the last line of the range.
- If a line range is not specified, the entire range of data being edited is processed.
- When browsing a keyed file, line ranges are not supported.
Example 1
Change all occurrences of a six-byte packed decimal field beginning at column 23 with a value of 45 to a six-byte packed decimal field with a value of 47:
Because no explicit range is specified in Example 1, the CHANGE command starts at the first line of the data being edited, scans all lines up to and including the last line, and changes all occurrences.
Example 2
Change all occurrences of a six-byte packed decimal field beginning at column 23 with a value of 45 to a six-byte packed decimal field with a value of 47:
In Example 2, processing starts at the line with label .RECA and ends at the line with sequence number 2544.
Related topics