* Declare a cursor for a given SQL statement. EXEC ADO DECLARE drCust DATAROWS FROM Customers END-EXEC EXEC ADO OPEN drCust END-EXEC * Fetch the current values from the cursor into the host variables * and if everything goes ok, display the values of the host * variables PERFORM UNTIL EXIT EXEC ADO FETCH NEXT drCust (CustomerID, CompanyName) INTO :Customers-CustomerID, :Customers-CompanyName END-EXEC IF SQLCODE < 0 or SQLCODE = 100 EXIT PERFORM END-IF DISPLAY "Customer ID = " Customers-CustomerID " Company Name = " Customers-CompanyName END-PERFORM