TESTSQLSTATE

Instructs OpenESQL to generate code that tests SQLSTATE rather than SQLCODE after an SQL statement is executed.

Syntax:

TESTSQLSTATE
NOTESTSQLSTATE

Properties:

Default: NOTESTSQLSTATE

Scope:

Used at compile time: Yes
Behavior at run time: N/A

See Scope - OpenESQL SQL Compiler Directive Options for more information.

Example:

           invoke wCLRRTS "adoastop" using
               by reference SQLCA
           move SQLCA(13:4) to MFSQLECM-SQLCODE-2(1:4)
           move SQLCA(101:1) to MFSQLECM-SQLWARN
           move SQLCA(132:2) to MFSQLECM-SQLSTATE-2
           perform MFSQLECM-UPD-SQLCA-2
           if MFSQLECM-SQLSTATE-2 not = "00" and MFSQLECM-SQLSTATE-2 not
      -        = "01" and MFSQLECM-SQLSTATE-2 not = "02"
               go to SQL-ERROR
           end-if
           if MFSQLECM-SQLCODE-2 > 0 and MFSQLECM-SQLCODE-2 not = 100
               move "W" to MFSQLECM-SQLWARN
           else
               if MFSQLECM-SQLCODE-2 not = 0
                   move " " to MFSQLECM-SQLWARN
               end-if
           end-if
           if MFSQLECM-SQLSTATE-2 = "01"
               go to SQL-ERROR
           end-if