The System z® LPEX
Editor, COBOL Editor, and PL/I editor provide content assist for EXEC
SQL statements in COBOL and PL/I source files. When the file is associated
with a property group that defines a DB2® for z/OS® database connection, content
assist can also provide assistance for database elements that are
used by the source file.
Before you begin
To obtain content assistance for database elements, you must
associate a property group with the local COBOL or PL/I project or
with the MVS™ subproject that
contains the source file you are editing. This property group must
contain a DB2 for z/OS database connection definition. For more
information about property groups and database connections, see the
following topics:
If you open a file from an SCLM view, such as the
SCLM
Explorer View,
SCLM Developer View,
or
SCLM Member View, specify the database connection
properties in the
Team > SCLM Preferences > Local Syntax
Check preference page rather than a property group.
To
set preferences for validation and content assist for EXEC SQL statements,
use the EXEC SQL Statements preference page.
For more information about setting preferences for EXEC SQL statements,
see Setting preferences for EXEC SQL statements.
About this task
Content assist for EXEC SQL statements provides the following
functions:
- Provides syntactic content-assist proposals for EXEC SQL statements.
- Provides content-assist proposals for database elements that are
used by the program under edit. These proposals can come from a live
database connection, from a database that has an offline cache available,
or from DECLARE TABLE statements within the program.
- Provides contextual edit-time validation and feedback for frequently
used EXEC SQL statements. Validation is performed only on the data
access statements SELECT, INSERT, UPDATE, and DELETE. The database
items that can be validated are schemas, tables, and columns.
Procedure
To use content assist for EXEC SQL statements, position
the cursor within an EXEC SQL statement and press Ctrl+Spacebar.
- For syntactic content assist, the editor proposes tokens
that are valid within the current statement. The proposals that
are provided are not based on a full grammar analysis of the current
statement, in which only the tokens that are valid at the cursor location
would be proposed.
- For database elements:
- The editor provides proposals that are based on the database that
is defined, the default schema property of the database connection,
the current statement, and the cursor position.
- If no database connection is active and you specify the Start
connections when needed preference setting, the proposals
that come from the database information might not be displayed initially.
After the connection is established, the proposals are displayed in
subsequent content-assist requests.
- Whenever DECLARE TABLE statements are present, the editor adds
the declared symbols into the content-assist proposals. DECLARE
TABLE statements are frequently contained in copybooks that are generated
by the DCLGEN utility. By using this utility, you can make full use
of this feature without an active database connection.
- For real-time validation, the database items that are being
edited are compared and validated against database item declarations
from two sources:
- A configured database connection that is associated with the edit
session through the property group.
- The optional SQL statement DECLARE TABLE.