pTAL Reference Manual (H06.08+)
Statements
HP pTAL Reference Manual—523746-006
12-43
Crossing Variable Boundaries
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 on page 12-43
•
Data Passed to Procedures in Reference Parameters on page 12-43
Data Layout Considerations
Data Passed to Procedures in Reference Parameters
The rules in of the preceding subsection about data layouts apply if the buffer scanned
in a SCAN statement is a reference parameter.
P-Relative Arrays
The address type of pointers in a SCAN statement that scans a P-relative array must
be CBADDR or CWADDR.
When the SCAN statement in Example 12-49 on page 12-44 completes, t_start
points to the first character in the third message, and t_end points immediately after
the last character in the third message. The object data type of t_start and t_end is
STRING; therefore, their address type is BADDR.
Example 12-48. Scanning Adjacent Fields Within a Structure
STRUCT s FIELDALIGN(SHARED2);
BEGIN
STRING buffer[0:99];
STRING stopper;
END;
BADDR end_addr;
...
s.stopper := 0;
SCAN s.buffer UNTIL char -> end_addr;
IF end_addr = @s.stopper THEN ! Target character was not found
BEGIN
...
END;










