DECLARE STATEMENT
The DECLARE STATEMENT statement is used for application program documentation. It declares names that are used to identify prepared SQL statements.
Invocation
This statement can be embedded only in a COBOL application program. It is not an executable statement.Syntax
Description
The following keyword parameters are defined for the DECLARE statement:- statement-name STATEMENT
- Lists one or more names that are used in your application program to identify prepared SQL statements.
Example
This example shows the use of the DECLARE STATEMENT statement in a COBOL program. It declares a statement named UPD.
EXEC SQLIMS
DECLARE UPD STATEMENT
END-EXEC.
EXEC SQLIMS
PREPARE UPD FROM :SQLSTMT
END-EXEC.
IF SQLIMSCODE < 0
MOVE ‘**** PREPARE ERROR ****’ TO ERR-MSG1
PERFORM 100-ERROR
ELSE
PERFORM EXECUTE-STMT
END-IF 