WHENEVER specifies the host language statement to be executed when an exception condition occurs.
Three types of WHENEVER :-
1.WHENEVER NOT FOUND
Example:
go to the label ENDDATA for any statement does not return
EXEC SQL
WHENEVER NOT FOUND
GO TO ENDDATA
END-EXEC.
NOT FOUND => Identifies any condition that results in an SQLCODE of +100.
2.WHENEVER SQLERROR
Go to label handler for any statement that produces an error
EXEC SQL
WHENEVER SQLERROR
GO TO HANDLER
END-EXEC.
SQLERROR => Identifies any condition that results in negative SQLCODE.
3.WHENEVER SQLWARNING
Continue the processing when any statement produces a warning
EXEC SQL
WHENEVER SQLWARNING
CONTINUE
END-EXEC.
SQLWARNING => Identifies any condition that results in warning condition (SQLWARN0 is W) or that results in Positive SQLCODE other than +100.
No comments:
Post a Comment