SQL/MX 3.1 Programming Manual for C and COBOL (H06.23+, J06.12+)

Exception Handling and Error Conditions
HP NonStop SQL/MX Release 3.1 Programming Manual for C and COBOL663854-001
13-21
Recovering From the Lost Open Error
Open Error (8574), as well as other recompilation errors, to the program. For more
information on similarity checks and automatic recompilation, see Section 8, Name
Resolution, Similarity Checks, and Automatic Recompilation.
Recovering From the Lost Open Error
If DML or cursor operations in a program enable concurrent access to tables or views,
or if you anticipate network or hardware interruptions, add code to the program to catch
and handle the Lost Open Error (8574). The way that you handle occurrences of the
Lost Open Error (8574) depends on what you are trying to accomplish with the DML
statement or cursor. In most cases, when the Lost Open Error (8574) occurs, the
program should retry the DML statement or close and reopen the cursor before
executing a subsequent FETCH statement.
This example provides general error recovery code:
void sql_error(void)
{
if (SQLCODE == -8574)
{
printf("Recovering cursor from error %ld\n", SQLCODE);
EXEC SQL Open C1;
}
}