z/OS ISPF Edit and Edit Macros
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


LINENUM—Query the Line Number of a Labeled Line

z/OS ISPF Edit and Edit Macros
SC19-3621-00

The LINENUM assignment statement retrieves the current relative line number of a specified label, and places it in a variable.

Syntax

Read syntax diagramSkip visual syntax diagram
Assignment statement syntax

>>-ISREDIT--(varname)-- = --LINENUM--label---------------------><

varname
The name of a variable to contain the line number of the line with the specified label. The line number is a 6-digit value that is left-padded with zeros. If the variable is VDEFINEd in character format, it should be defined with a length of 8. The returned value is left-padded with zeros. For compatibility with previous releases of ISPF, a length of 6 or 7 is allowed in cases where no data loss will occur.
label
The name of the label for the line whose line number is needed.

Return codes

0
Normal completion
4
Line 0 specified
8
Label specified, but not found (variable set to 0)
12
Invalid line number
20
Severe error

Description

Once the line number is retrieved and placed in a variable, it can be used in arithmetic operations. Note that line numbers are relative to the position of the line: first=1, second=2, and so on. Therefore, the value returned by the LINENUM assignment statement is not always be correct if lines are added or deleted before the line number is obtained.

Examples

To determine the number of lines in the data set and set variable &VAR to the last line number:
ISREDIT (VAR) = LINENUM .ZLAST

That number is 0 if there are no lines.

To set variable &NUM to the line number containing the label .MYLAB:
ISREDIT (NUM) = LINENUM .MYLAB

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014