3. Embedded QUEL for COBOL : Precompiling, Compiling, and Linking an EQUEL Program : Coding Requirements for Writing EQUEL Programs : COBOL Periods and EQUEL Statements
 
Share this page                  
COBOL Periods and EQUEL Statements
You can optionally follow an EQUEL statement with a COBOL separator period although the preprocessor never requires that a period follow an EQUEL statement. If the period is present at the end of an EQUEL statement, however, the last COBOL statement that the preprocessor generates for that statement also ends with a period. Therefore, you should follow the same guidelines for using the separator period in EQUEL statements as in COBOL statements. For instance, do not add a period at the end of an EQUEL statement occurring in the middle of the scope of a COBOL IF or PERFORM statement. If you include the separator period in such a case, you prematurely end the scope of the COBOL statement. Similarly, when an EQUEL statement is the last statement in the scope of a COBOL IF, you must follow it with a period (or, alternatively, an END-IF) to terminate the scope of the IF.
For example:
     IF ERR-NO > 0 THEN
* Do not use a separating period in the middle of an IF
* statement.
##         MESSAGE "You cannot update the database"
* Be sure to use a separating period at the end of 
* an IF statement.
##         SLEEP 2.
In the example above, the absence of the period after the first message statement causes the preprocessor to generate code without the separator period, thus preserving the scope of the IF statement. The period following the sleep statement causes the preprocessor to generate code with a final separator period, terminating the scope of the IF.