You can use the EXECSQL command environment to process the SQL.
Each SQL statement is prepared and executed dynamically using the
CICS/DB2 attachment facility.
You can make each request by writing a valid SQL statement as a
REXX command directed to the EXECSQL environment. The SQL statement
is made up of the following elements:
- SQL keywords
- Pre-declared identifiers
- Literal values.
Use the following syntax:
"EXECSQL statement"
or
ADDRESS EXECSQL
"statement"
"statement"
.
.
.
SQL can exist on more than one line. Each part of the statement
is enclosed in quotes and a comma delimits additional statement text
as follows:
ADDRESS EXECSQL
"SQL text",
"additional text",
.
.
.
"final text"
The following rules apply to embedded
SQL:
- You can pass the following SQL directly to the EXECSQL command
environment:
- ALTER
- CREATE
- COMMENT ON
- DELETE
- DROP
- EXPLAIN
- GRANT
- INSERT
- LABEL ON
- LOCK
- REVOKE
- SELECT
- SET CURRENT SQLID
- UPDATE.
- You cannot use the following SQL:
- BEGIN DECLARE SECTION
- CLOSE
- COMMIT
- CONNECT
- DECLARE CURSOR
- DECLARE STATEMENT
- DECLARE TABLE
- DESCRIBE
- END DECLARE SECTION
- EXECUTE
- EXECUTE IMMEDIATE
- FETCH
- INCLUDE
- OPEN
- PREPARE
- ROLLBACK
- SET CURRENT PACKAGESET
- SET HOST VARIABLE
- WHENEVER.
- Host variables are not allowed within the SQL. Instead, you can
use REXX variables to pass input data to the EXECSQL environment.
The REXX variables are not embedded within quotes. The output from
the EXECSQL environment is provided in REXX predefined variables (see
section Receiving the Results).
- When you code a SQL SELECT statement, you cannot use the INTO
clause. Instead, the REXX/CICS DB2 returns the requested items in
compound variables with stem names equal to the DB2 column names.
- The default number of rows returned for a SELECT statement is
250. If you need more or less rows, you can set the REXX variable
SQL_SELECT_MAX before issuing the SELECT statement.