J. Notes for Users of QUEL : While (QUEL)
 
Share this page                  
While (QUEL)
Repeats a series of statements while a specified condition is true.
QUEL examples are given below. See While for a description of the while statement.
Examples (QUEL Only)
Use the while statement to handle deadlock:
succeed := 0;     /* Set to 1 when and if */
             /* append is successful */
tries := 1;
ingerr := 0;

A:   while succeed = 0 and tries <= 10 do
    ...append statement to try to append
    to database...
    inquire_ingres (ingerr = "errorno");
    if ingerr = 0 then
      /* Append completed successfully */
      succeed := 1;
    elseif ingerr = 4700 then
      /* Error due to deadlock - try again */
      tries := tries + 1;
    else
      endloop A;
    endif;
  endwhile;
if succeed = 1 then
  message "Append completed successfully";
  sleep 3;
else
  message "Append failed";
  sleep 3;
endif;