Downloading data: about the CSARESCK sample code

The CSARESCK sample CSA downloads data to Adaptive Server Enterprise through a series of insert statements. It illustrates the error checking you need to include in a CSA when downloading data from a source on the mainframe directly to Adaptive Server Enterprise. CSARESCK shows you how to use the CSA RESCHECK and GETMSG commands to ensure that you download data correctly.

The Adaptive Server Enterprise table is specified with a unique index. Three of the statements fail with warnings because they attempt to place a value in a field that is already indexed with that value.

The duplicate insert statements are highlighted in the code.

It is important for you to understand that this method for determining which SQL statement succeeds and which fails works only if the error caused by the batched statements is a warning level error. In the case of warning messages, Adaptive Server Enterprise returns a success or warning message for each of the batched commands.

NoteIf any one of your batched commands causes a serious error, Adaptive Server Enterprise issues a ROLLBACK transaction, rolls back all the batched commands, and issues only one error message. This makes it impossible to determine the batched command that failed.

CSARESCK illustrates: