Documentation

12.11 Indices, definition and use: COD03-COD06 and COD12

Once the code parses, qc-nm builds a practical map of where model symbols come from and where they go. COD03 checks THETA(n), COD04 checks ETA(n), COD05 checks EPS(n) or ERR(n), COD06 looks for variables used before they are defined, and COD12 reports variables that are defined but apparently never used or written to a table.

Definitions flow through the control stream into outputs

Think of the model as a chain

Every indexed reference must have a matching parameter value. If the model contains THETA(5) but only four THETAs are declared, the model is structurally inconsistent. The reverse matters too: a declared THETA that is never referenced may be an obsolete parameter left behind after model editing. Similar reasoning applies to ETA/OMEGA and EPS/SIGMA.

COD06 extends that reasoning to ordinary variables. For example, CL=TVCL*EXP(ETA(1)) requires TVCL to be a data item, a recognized NONMEM value, or a value assigned earlier in a legal scope. A finding can be caused by a spelling difference, the order of statements, or a definition hidden on only one conditional branch.

COD12 is primarily a cleanup signal. An intentionally table-only intermediate can be legitimate, and generated or advanced NONMEM code can be difficult to resolve statically. Before deleting anything, search $TABLE, included source, and downstream blocks. A variable that looks unused to a checker may still be part of a scientific audit trail.

Common mistakes

  • Adding an OMEGA merely to silence an out-of-range ETA instead of correcting the intended index.
  • Renumbering THETAs without updating comments, labels, and report interpretation.
  • Assuming assignment inside an IF guarantees definition on every path.
  • Deleting a variable reported by COD12 before checking tables and included code.

Checklist

  • Count declared THETA, OMEGA, and SIGMA elements.
  • Trace each indexed reference to the intended parameter and label.
  • Resolve misspellings and branch-dependent definitions.
  • Review, rather than automatically remove, every unused symbol.
  • Compile and run representative records after any renumbering.

Further reading

See parameter blocks, OMEGA and SIGMA, and checker limits.