pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Determining What Stopped a Scan
To determine what stopped a scan, test $CARRY in an IF statement immediately after the SCAN
or RSCAN statement.
Example 186 Determining What Stopped a Scan
IF $CARRY THEN ... ; ! If test character not found
IF NOT $CARRY THEN ... ; ! If test character found
If $CARRY is true after a SCAN UNTIL, the test character did not occur. If $CARRY is true after
SCAN WHILE, a character other than the test character did not occur.
To determine the number of multibyte elements processed, divide (next-addr '-' byte address of
identifier ) by the number of bytes per element using unsigned arithmetic.
For more information about $CARRY, see Chapter 13 (page 234).
Extended Pointers
Example 187 Extended Pointers in SCAN and RSCAN Statements
STRING .EXT eas;
STRING .EXT eat;
EXTADDR ea;
STRING .EXT32 e32as;
STRING .EXT32 e32at;
EXT32ADDR e32a;
STRING .EXT64 e64as;
STRING .EXT64 e64at;
EXT64ADDR e64a;
SCAN eas until " " -> @eat; ! OK
SCAN eas until " " -> ea; ! OK
SCAN e32as until " " -> @e32at; ! OK
SCAN e32as until " " -> e32a; ! OK
SCAN e64as until " " -> @e64at; ! OK
SCAN e64as until " " -> e64a; ! OK
NOTE: EXT32ADDR, EXT64ADDR, .EXT32, and .EXT64 are 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).
Crossing Variable Boundaries
SCAN and RSCAN statements can access data contained within single named variables or arrays
as long as the scan encounters either the target character specified in the SCAN or RSCAN
statement or a 0 byte before it reaches the end of the named variable or array.
SCAN and RSCAN statements that depend on accessing data that precedes or follows the variable
named in the SCAN or RSCAN statement do not work.
Topics:
• Data Layout Considerations (page 231)
• Data Passed to Procedures in Reference Parameters (page 231)
230 Statements