WITH HOLD cursors
EXEC SQL DECLARE READ-IT CURSOR WITH HOLD FOR
select empno, ename, job
from emp
order by empno
END-EXEC.
will produce the Elastic COBOL compiler error:
PRC8051E WITH HOLD not supported.
The "WITH HOLD" option is for holding open a cursor (and its locks) when another cursor releases locks as a result of a COMMIT TRANSACTION. Commonly seen when a "master" table is searched in one cursor (with hold) while for each fetched row, another update operation is performed on a "detail" record of another table. To keep update locks on the detail table as brief as possible, a commit (or rollback) is performed after each update.
Unfortunately, this feature is not supported in JDBC 3 and earlier and most databases other than DB2. When a "commit transaction" is performed in JDBC 3 all locks are released, necessitating the closing of all open cursors. Elastic COBOL has a compiler directive to use JDBC 4 which supports WITH HOLD but the underlying databases may not. Use "-sql:jdbc 4" compiler option when invoking the compiler or place in your code:
$SET DIRECTIVE "-sql:jdbc 4"
If your database or driver does not support WITH HOLD then as part of the modernization effort it will be necessary to take into account the features and functions of the destination database management system when migrating code.
Indeed, an APAR was released by IBM for their Java driver code on zOS to ensure that zOS environments throw this error instead of ignoring it ( http://www-01.ibm.com/support/docview.wss?uid=swg1IY76372 ).
WITH RETURN cursors
The same issues concern the WITH RETURN clause of the cursor declaration.
0 Comments