Previous Topic: PL/I and CNext Topic: Rules for Coding Embedded SQL


Assembler

All embedded SQL statements in Assembler programs are preceded by the keywords EXEC SQL and ended on a record for which the continuation field is not used.

 EXEC SQL                                                              X
     statement                                                         X
     statement

The identifying words EXEC SQL (which are reserved), and the statement can appear on one or more lines within the prescribed margins. Do not include code unrelated to SQL on these lines since the SQL Preprocessor for Assembler comments them. The word EXEC must be separated from the word SQL, and the word SQL must be separated from the statement.

Example 1

 EXEC SQL                                                              X
     DECLARE ADDR_CURSOR CURSOR FOR                                    X
     SELECT ID, NAME_LAST, STATE FROM ADDRTBL

Example 2

 EXEC SQL                                                              X
     WHENEVER NOT FOUND GOTO ALLDONE

Example 3

 EXEC SQL                                                              X
     FETCH ADDR_CURSOR                                                 X
         INTO :HID, :HNAME_LAST, :HSTATE

Example 4

 EXEC SQL CLOSE ADDR_CURSOR