CDC_ExitSQLError

The exit procedure CDC_ExitSQLError is called if an error has occurred during the execution of an SQL statement. A decision can be made in the exit whether the error can be ignored.

Parameter Stem
Input X_SQE_I
Output X_SQE_O
Input Parameters
X_SQE_I.ReturnCode The tcSCRIPT error return code
X_SQE_I.MessageText The error message related to the return code
X_SQE_I.Timestamp Timestamp of source change
X_SQE_I.SQL_DML The SQL DML statement
X_SQE_I.Parm_Count Number of parameter values for the SQL DMLstatement. It is 0 (zero) for array operations.

The following fields have an index from 1 to X_SQE.Parm_Count:

X_SQE_I.Parm_Name.suffix Name of parameter
X_SQE_I.Parm_Type.suffix SQL type of parameter
X_SQE_I.Parm_Length.suffix SQL length of parameter
X_SQE_I.Parm_Scale.suffix SQL scale of parameter
X_SQE_I.Parm_KeyNr.suffix If > 0: Represents the parameter sequence number in the unique key
X_SQE_I.Parm_Null.suffix 1 - value is NULL
X_SQE_I.Parm_Value.suffix Parameter value

Target-specific Input Parameters:

MongoDB:
X_SQE_I.MongoDBDocument The JSON document of the operation
X_SQE_I.MongoDBQuery The JSON for the condition of the operation
X_SQE_I.MongoDBOptions The JSON for the options, only for subdocuments
Adabas:
X_SQE_I.AdabasDatabaseNumber Adabas database number
X_SQE_I.AdabasFileNumber Adabas file number
X_SQE_I.AdabasISN The ISN of the used CB (command blocks)
X_SQE_I.AdabasCommandCode The command code of the used CB
X_SQE_I.AdabasResponseCode The response code of the used CB
X_SQE_I.AdabasCommandOption1 Content of Command Option 1 of the used CB
X_SQE_I.AdabasCommandOption2 Content of Command Option 2 of the used CB
X_SQE_I.AdabasAdditions1 Content of Additions 1 of the used CB
X_SQE_I.AdabasAdditions2 Content of Additions 2 of the used CB
DL/I:
X_SQE_I.DLIDatabaseName DLI database name
X_SQE_I.DLISegmentName Segment name
X_SQE_I.DLILevelFeedback PCB level feedback
X_SQE_I.DLIStatusCode PCB status code
X_SQE_I.DLIProcessingOptions Processing options
X_SQE_I.DLISensitiveSegments Sensitive segments
X_SQE_I.DLIKeyFeedbackArea KeyFeedbackArea of the dataset
Datacom:
X_SQE_I.DATACOMcommand Used Datacom command
X_SQE_I.DATACOMReturnCode Return code
X_SQE_I.DATACOMReasonCode Reason code
X_SQE_I.DATACOMDatabaseID Database ID
X_SQE_I.DATACOMFileName Filename
X_SQE_I.DATACOMKeyName Key name
X_SQE_I.DATACOMElementList Element list
Output Parameter
X_SQE_O.ReturnFlags

Return value

  • 0 - Do not ignore the error
  • 1 - Ignore the error, continue processing

Example:

CDC_ExitSQLError:
say "***"
say "An SQL error has occurred"
say "X_SQE_I.ReturnCode " d2x(X_SQE_I.ReturnCode)
say "X_SQE_I.MessageText" X_SQE_I.MessageText
say "X_SQE_I.SQL_DML    " X_SQE_I.SQL_DML
say "X_SQE_I.Parm_Count " X_SQE_I.Parm_Count

do i = 1 to X_SQE_I.Parm_Count
	say i X_SQE_I.Parm_Name.i
end
X_SQE_O.ReturnFlags = 0

/* Just ignore DB2 constraint violations */
if index(X_SQE_I.MessageText, "-803") > 0 then 
do
	X_SQE_O.ReturnFlags = 1
	say "Error ignored"
end

return "0, No error"