Skip to content

Exit program reason codes

What the exit program does

Stelo Capture doesn't delete journal receivers itself: the operating system (with system-managed receiver deletion), users or journal management tools do. So that a receiver the Capture Agent still has to read isn't deleted too early, Stelo Capture registers an exit program (CADLTRCV, in the agent's library on the IBM i) for the IBM i delete journal receiver exit point. Before a receiver is deleted, the exit program approves or refuses the deletion and records why, as a reason code.

It protects receivers the agent manages: those of the journal Stelo Capture creates (SQDR), and of your own journals when managedLogs is true, as it is for Db2 for i agents the SQDR Control Center creates. The agent registers the exit program each time it starts, unless both managedLogs and autoJournal are false: then it removes the registration and logs managedLogs and AutoJournal off, EXIT program not installed. To remove it, see Remove the Db2 for i exit program.

Where to see the reason codes

The exit program sends a message to the message queue CALOGQ in the agent's library; the Capture Agent writes each message to its own log, on the agent's Diagnostics tab. A message looks like CALDTRCV: ..., Receiver(<library>/<receiver>), Journal(<library>.<journal>), OK to Delete, ...; Reason(3). If the agent was stopped, it notes how long the message waited on the queue.

Which messages are written depends on the agent's logLevel: agents created with the Add Capture Agent wizard log at INFO by default, which shows every code below except 0 and 1; those need FINE.

Terms

  • Candidate: the journal receiver about to be deleted.
  • Current: the receiver the Capture Agent is reading now. That isn't necessarily the attached receiver, which the operating system writes new entries to: an agent that is behind reads an older receiver.

Reason codes

The exit program first looks for the Current receiver by following the receiver chain from the Candidate. When the Candidate isn't in a chain with the Current receiver (always the case for a remote journal), it compares the receivers' attach times and sequence numbers instead (codes 6.1 to 8).

Code Log level OK to delete? Message What it means
0 FINE Yes Journal not in-use by SQDR This agent doesn't read the journal. Common.
1 FINE Yes OK to Delete because SQDR not managing Receivers The journal is yours (not SQDR) and managedLogs is false.
2 INFO No Receiver matches Current Receiver The agent is still reading this receiver. Common with an agent slightly behind, or not started.
3 INFO Yes Receiver is prior in chain to Current Receiver The agent has finished with this receiver. The usual result for an agent that keeps up.
4 INFO Yes RECEIVER CHAIN BREAK DETECTED - allowing Deletion The receiver chain is broken, so the Current receiver can't be found from the Candidate. Check the journal environment.
5 WARNING No Not OK to Delete due to previous error Following the receiver chain failed; the error is in the message.
6.1 WARNING No Not OK to Delete due to previous error (for example Current Receiver Missing) The Current receiver couldn't be examined.
6.2 INFO No Not OK to Delete - would break Chain (Capture NOT RUNNING?) The Candidate is newer than the Current receiver: the agent is more than one receiver behind, or not running.
7 INFO Yes [Remote] Receiver is prior to Current Receiver The Candidate was attached before the Current receiver. The usual result for a remote journal whose agent keeps up.
8 INFO Yes [Remote] Receiver is prior to Current Receiver but sequence was RESET The Candidate is older but has higher sequence numbers: the journal's sequence numbers were reset (CHGJRN SEQOPT(*RESET)). Rare.
8 WARNING No Agent scanning for new receiver The agent's position in this journal is being reset (for example by a new start position), so no receiver may be deleted until it has found its receiver.

If the exit program can't read the agent's tables, it logs SQL Error detected in CADLTRCV (SEVERE) with the SQLSTATE, and refuses the deletion.