Previous Topic: SIMULATE DATACOM PROCEDURE StatementNext Topic: Examples


Example

A WHILE statement example follows. In the example that follows, logic that is not shown (for space considerations) is indicated by three vertically arranged periods.

   .
   .
   .
   DECLARE continue HANDLER FOR sqlexception, sqlwarning, not found
      GET stacked DIAGNOSTICS
         sqlStateLocal = RETURNED_SQLSTATE, errMsg = MESSAGE_TEXT;
   .
   .
   .
 startWhile:
    WHILE sqlStateLocal <-> '00000' DO
       FETCH orderCrs INTO orderId, custId, creditReqAmt;
       .
       .
       .
    END WHILE endWhile DATACOM LOOPLIMIT 10000;
    .
    .
    .