The WHENEVER precompiler-directive statement specifies an action to be taken when the execution of an SQL statement results in a nonzero SQLCODE value. The WHENEVER statement directs the precompiler to insert the appropriate conditional code after each subsequent SQL statement that generates a call to CA IDMS
You can use this statement only in SQL that is embedded in a program.
None required.
►►─── WHENEVER ─┬─ NOT FOUND ─┬─┬─ CONTINUE ─────────────────────────────┬───►◄ ├─ SQLERROR ───┤ ├─┬─ GO TO ─┬─┬─ label ──┬─┬─────────────┘ └─ SQLWARNING ─┘ │ └─ GOTO ─┘ └─ :label ─┘ │ └─ CALL subroutine-name ───┘
Directs CA IDMS to take the specified action when the execution of an SQL statement results in an SQLCODE value of 100.
Directs CA IDMS to take the specified action when the execution of an SQL statement results in an SQLCODE value that is less than zero.
Directs CA IDMS to take the specified action when the execution of an SQL statement results in an SQLCODE value of 1.
SQLWARNING is a CA IDMS extension of the SQL standard.
Specifies that processing is to continue with the next statement.
Specifies that processing is to continue with the first statement at the named label. Label must be the name of a section or the unqualified name of a paragraph in the application program.
GO TO and GOTO are synonyms and can be used interchangeably. Label and :label are synonyms and can be used interchangeably.
The GO TO parameter is not valid in CA ADS application programs.
The specification of a label without a colon (:) is a CA IDMS extension of the SQL standard.
Specifies that processing control is to pass to the named subroutine. Subroutine-name must identify a subroutine subsequently defined in the process module.
The CALL parameter is valid only in CA ADS process modules.
The CALL parameter is a CA IDMS extension of the SQL standard.
Scope of the WHENEVER Statement
The WHENEVER statement for a specified condition applies to all subsequent SQL statements until the precompiler encounters another WHENEVER statement that names the same condition.
Specifying Error Processing
The following WHENEVER statement specifies that control is to pass to the section or paragraph named SQLCODE-CHECK whenever CA IDMS returns a negative value in SQLCODE:
EXEC SQL
WHENEVER SQLERROR
GO TO :SQLCODE-CHECK
END-EXEC
|
Copyright © 2014 CA.
All rights reserved.
|
|