TACL Reference Manual
Built-In Functions and Variables
HP NonStop TACL Reference Manual—429513-018
9-46
#CHARADDR Built-In Function
#CHARADDR Built-In Function
Use #CHARADDR to convert a line address to a character address.
variable-level
is an existing variable level to be operated upon. It must not be a DIRECTORY, a
STRUCT, or a STRUCT item.
line-addr
is an integer or a variable level that contains an integer. line-addr specifies the
line number of the line to be converted. The line number must be in the range from
1 to max-int, inclusive.
Result
#CHARADDR returns the address of the first character of the specified line.
Considerations
•
If line-addr is greater than the number of lines in the variable, #CHARADDR
returns the character address of the last end-of-line, plus one.
•
Each logical line contains an end-of-line character that counts as one byte. For
variables that contain TACL statements, each metacharacter uses the number of
visible characters plus one, including unprintable characters that are subject to
change from one TACL RVU to another. Nonmetacharacters use one byte.
•
If variable-level is empty, #CHARADDR returns zero.
Example
Assume that var is a variable level containing these characters:
ABCDEFG
HIJKLMNOPQRST
UVWXYZ
The invocation:
#CHARADDR var 2
returns 9; the letter H at the beginning of line 2 is the ninth character in var, counting
the end-of-line between lines 1 and 2 as one character.
The invocation:
#CHARADDR var 100
returns 30: the 26 characters, three end-of-line characters, plus one.
#CHARADDR variable-level line-addr