TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-49
#CHARCOUNT Built-In Function
#CHARCOUNT Built-In Function
Use #CHARCOUNT to obtain the number of characters in a variable level.
variable-level
is the name of an existing variable level whose characters are to be counted. It
must not be a DIRECTORY, a STRUCT, or a STRUCT item.
Result
#CHARCOUNT returns the number of characters in the variable level, counting each
end-of-line except the last as a character and counting each internal representation of
[, |, or ] as multiple characters.
Considerations
To make a quoted string yield the same character count as a variable level
containing the same text (minus the quotation marks), the final end-of-line in a
variable level is not counted. This means that #CHARCOUNT does not necessarily
yield the same result as #VARIABLEINFO /OCCURS/, which includes all end-of-
lines in its count.
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.
Examples
1. Assume that var is a variable level containing:
ABCDEFG
The invocation:
#CHARCOUNT var
returns 7; #CHARCOUNT does not count the last end-of-line character in a
variable level as a character.
2. Assume that var is a variable level containing:
ABCDEFG
HIJKLMNOPQRST
UVWXYZ
The invocation:
#CHARCOUNT var
#CHARCOUNT variable-level