SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-6
Requirements for Compiling a COBOL Program
Requirements for Compiling a COBOL Program
Before compiling the program, verify that the source code contains the required
elements for compilation.
Feature or Option COBOL Compiler Requirements
SQL directive Required either in the compilation unit before the first Identification
Division or on the compiler command line of the COBOL85
compiler (TNS mode)
Required on the compiler command line of the NMCOBOL
compiler (TNS/R mode)
See the SQL Compiler Directive
on page 6-7.
SQLMEM directive Optional in the source code or on the compiler command line of
the COBOL85 compiler (TNS mode)
See the COBOL85 for NonStop Systems Manual.
SQLCODE identifier Required for each program and nested program. You must
declare an SQLCODE identifier either explicitly as a data item or
implicitly using the INCLUDE SQLCA directive.
See Section 9, Error and Status Reporting
.
SQLCODE level-88
items
Optional. You can use level-88 items with an SQLCODE data item
by substituting an SQLCODEX data item. See Using the
SQLCODEX Data Item on page 9-6.
SQLCA data structure The compiler:
Declares an SQLCA structure in a program only if the source
file specifies an INCLUDE SQLCA directive.
Allows an INCLUDE SQLCA directive in the
Extended-Storage Section.
SQL statement
placement
Allows COBOL statements and embedded SQL statements to be
on the same line, except that a COBOL statement must follow the
SQL statement terminator, cannot precede an SQL statement,
and cannot be a COPY or REPLACE statement.
Library files Supports the COBOL SOURCE directive.
COPY and
REPLACE statements
The compiler implements these restrictions:
A COPY or REPLACE statement is not allowed within SQL
statements and cannot contain SQL statements. COPY and
REPLACE affect SQL statements only between BEGIN DECLARE
and END DECLARE directives.
A COPY statement cannot copy source text that contains
SQL statements.
A REPLACE statement that precedes one or more SQL
statements does not affect them, except in a Declare Section.
SQL cursors Supports local and foreign cursors.
SQL statements in
listing
Lists SQL statements in the compiler listing exactly as they appear
in the source program.