pTAL Reference Manual (H06.03+)

Statements
HP pTAL Reference Manual523746-005
12-17
DO-UNTIL
Example 12-13 on page 12-17 selectively moves one of several messages into an
array.
DO-UNTIL
The DO-UNTIL statement is a posttest loop that repeatedly executes a statement until
a specified condition becomes true.
statement
is any statement described in this section.
Example 12-12. Unlabeled CASE Statement
INT selector;
INT var0;
INT var1;
CASE selector OF
BEGIN
var0 := 0; ! Executes if selector=0
var1 := 1; ! Executes if selector=1
OTHERWISE
CALL error_handler; ! Executes if selector is not 0 or 1
END;
Example 12-13. Unlabeled CASE Statement Assigning Text to Array
PROC msg_handler (selector);
INT selector;
BEGIN
LITERAL len = 80; ! Length of array
STRING .a_array[0:len - 1]; ! Destination array
CASE selector OF
BEGIN ! Move statements
!0! a_array ':=' "Training Program";
!1! a_array ':=' "End of Program";
!2! a_array ':=' "Input Error";
!3! a_array ':=' "Home Terminal Now Open";
OTHERWISE
a_array ':=' "Bad Message Number";
END; ! End of CASE statement
END; ! End of procedure
DO
statement
UNTIL condition
VST046.vsd