pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
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 variable of address type BADDR, SGXBADDR, SGBADDR, EXTADDR, EXT32ADDR, or
EXT64ADDR. If the source for the scan uses standard (non-extended) addressing, the next-address
variable must have the type BADDR.
NOTE: The address types, EXT32ADDR and EXT64ADDR are available in the 64-bit addressing
functionality added to the EpTAL compiler starting with SPR T0561H01^AAP. For more
information, see Appendix E, “64-bit Addressing Functionality” (page 531).
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 185 (page 229) 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.
Example 185 SCAN UNTIL Statement
INT .words[-1:3] := [0,"Doe, J",0];
STRING .byte_ptr := @words[0] '<<' 1; ! Initialize with byte
! address of words[0]
SCAN byte_ptr[0] UNTIL ","; ! Scan bytes in words
Topics:
• Determining What Stopped a Scan (page 230)
• Extended Pointers (page 230)
• Crossing Variable Boundaries (page 230)
• P-Relative Arrays (page 231)
SCAN and RSCAN 229