3. Embedded QUEL for COBOL : Precompiling, Compiling, and Linking an EQUEL Program : Coding Requirements for Writing EQUEL Programs : An EQUEL Statement that Does Not Generate Code
 
Share this page                  
An EQUEL Statement that Does Not Generate Code
The declare cursor statement does not generate any COBOL code. Do not code this statement as the only statement in any COBOL construct that does not allow null statements. For example, coding a declare cursor statement as the only statement in a COBOL IF statement causes compiler errors:
    IF USING-DATABASE=1 THEN
##         DECLARE CURSOR empcsr FOR 
## RETRIEVE (employee.ename)
       ELSE
       DISPLAY "You have not accessed the database".
The code generated by the preprocessor would be:
   IF USING-DATABASE=1 THEN
   ELSE
        DISPLAY "You have not accessed the database".
which is an illegal use of the COBOL ELSE clause.