pTAL Reference Manual (H06.03+)

Statements
HP pTAL Reference Manual523746-005
12-41
SCAN and RSCAN
RSCAN
indicates a right-to-left search.
variable
is the identifier, with or without an index, of a variable at which to start the scan.
The following restrictions apply:
The variable can be a simple variable, array, read-only array, simple pointer,
structure pointer, structure, or structure data item.
The variable can be of any data type but UNSIGNED.
The variable cannot have extended indirection.
WHILE
specifies that the scan continues until a character other than test-char occurs
or until a 0 occurs. A scan stopped by a character other than test-char resets
$CARRY. A scan stopped by a 0 sets $CARRY.
UNTIL
specifies that the scan continues either until test-char occurs or until a 0
occurs. A scan stopped by test-char resets the hardware carry bit. A scan
stopped by a 0 sets the hardware carry bit.
test-char
is an INT arithmetic expression whose value is a maximum of eight significant bits
(one byte). A larger value might cause execution errors.
next-addr
is a 16-bit variable to contain the 16-bit byte address of the character that stopped
the scan, regardless of the data type of identifier.
Delimit the scan area with zeros; otherwise, a scan operation might continue to pass all
valid data if either:
A SCAN UNTIL operation does not find a zero or the test character.
A SCAN WHILE operation does not find a zero or a character other than the test
character.
To delimit the scan area, you can specify zeros as follows:
INT .buffer[-1:10] := [0," John James Jones ",0];
Example 12-45 on page 12-42 converts the word address of an INT array to a byte
address. The assignment statement stores the resulting byte address in a STRING
pointer. The SCAN statement then scans the bytes in the array until it finds a comma.