DB2

DB2 SQLCODE -805 in COBOL Batch Support: A Practical Package and Plan Diagnosis

Learn how to diagnose DB2 SQLCODE -805 in COBOL batch support by checking package identity, plan resolution, release alignment, and safe restart decisions.

ProgramPlanPackageDB2 access
Original DBala learning flow — a visual summary of this article’s practical decision path.

Short introduction

A DB2 SQLCODE -805 means DB2 cannot find the required package through the executing plan. It is tempting to treat it as a simple “rebind it” incident, but the package may be in the wrong subsystem or collection, the plan may resolve differently, or the job may run an older load module.

The safe support approach is to compare the requested package, runtime plan, collection, and load module, then follow the approved release or bind procedure. Examples are generic; local authority and commands vary.

Real-world production use case

Consider a nightly claims-enrichment job. A COBOL program reads validated claim input, retrieves reference data from DB2, writes an enriched extract, and records exceptions. The job normally runs after upstream validation and before a reporting feed is created.

A release team deploys a new program load module and its DBRM-related artifacts. The batch job later fails in its application step with SQLCODE=-805. The scheduler reports a non-zero return code, but the previous sort step completed successfully. Operations needs an answer before deciding whether to rerun the job.

Do not submit the same job again immediately; it will normally fail until the mismatch is corrected. Preserve the spool, identify the program and consistency token, confirm release status, and check commit/checkpoint messages before deciding on restart. Even a failure at the first SQL call should be verified from the log, not assumed to have no impact.

Step-by-step explanation

### 1. Capture the complete diagnostic message

The -805 message commonly includes a location, collection identifier, package name, and consistency token. Those details are the investigation key. Copy the full message from the job output or DB2 diagnostic output into the incident record, following local rules for sensitive information.

Also capture the job name and ID, failing step, program name, subsystem identifier, STEPLIB or JOBLIB concatenation, plan name, and release/change reference. A short message such as “package missing” is not sufficient for another analyst to reproduce the investigation.

Do not confuse -805 with other SQL failures. -818, for example, points to a timestamp mismatch between an application load module and DBRM/package. A missing object, unavailable resource, or authorization failure requires a different path. The exact SQLCODE is important.

### 2. Identify the runtime plan and package resolution path

A DB2 application does not usually call a package by source-program name alone. DB2 uses the runtime plan and its package-list or collection rules. A package can therefore exist and still produce -805 when that plan cannot resolve it.

Start with the JCL and site runbook. Some installations use SYSTSIN commands such as DSN SYSTEM(...) and RUN PROGRAM(...) PLAN(...); others use an application-specific DB2 attachment. Determine the actual plan and subsystem rather than relying on a plan name remembered from a previous release.

Then compare the requested collection, package, and consistency token in the message with the intended release artifacts. A package in a development collection does not resolve a production job. Similarly, a package bound in the correct collection but under an older consistency token may not match a newly promoted load module.

### 3. Confirm what actually ran

Common causes are incomplete promotion, a bind in a different subsystem, or JCL library order that runs an unexpected version. Review JOBLIB, STEPLIB, procedure overrides, and scheduler variables. Confirm module, load library, release level, and bind collection through deployment records. Do not experiment with concatenation order in production.

### 4. Validate package and plan metadata with the DB2 team or approved query

Organizations differ in who can query DB2 catalog tables or issue DISPLAY PACKAGE commands. If your operational role permits it, use read-only checks first. The goal is to answer these questions:

Do not bind a package just because one exists with a similar name. A manual bind can introduce the wrong DBRM, options, owner, qualifier, or release version. Follow the application’s source-controlled bind JCL and change process. Where package versioning is used, include version details in the comparison.

### 5. Correct the release mismatch and restart deliberately

After an authorized owner corrects the package/plan deployment, decide how to restart the batch cycle. If the job stopped before any commits, a normal rerun may be appropriate. If it committed data before reaching the SQL call that failed, use the application’s checkpoint or restart process. JCL RESTART= only chooses the step where execution resumes; it does not undo committed DB2 work or prevent duplicate output.

Before restart, check catalog status of output datasets and GDGs, prior step return codes, counts written by the application, and whether a downstream trigger was created. Record the package correction and restart decision in the ticket or runbook notes.

Example JCL and diagnostic pattern

The following simplified JCL shows an application step that invokes DB2 through IKJEFT01. It is illustrative only; use local subsystem names, procedures, and bind standards.

//DB2RUN   EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB  DD DSN=ACME.CLAIMS.PROD.LOADLIB,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSTSIN  DD *
  DSN SYSTEM(DBP1)
  RUN PROGRAM(CLMENR01) PLAN(CLMENRP) LIBRARY('ACME.CLAIMS.PROD.LOADLIB')
  END
/*
//CLAIMIN  DD DSN=ACME.CLAIMS.VALIDATED(+0),DISP=SHR
//OUTFILE  DD DSN=ACME.CLAIMS.ENRICHED(+1),
//            DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(20,10)),
//            DCB=(RECFM=FB,LRECL=240)

A support note might record a diagnostic in this form:

DB2 SQLCODE -805 during CLMENR01
Subsystem: DBP1   Plan: CLMENRP
Requested package: collection=CLMPRD package=CLMENR01 token=AB12CD34
Runtime load library: ACME.CLAIMS.PROD.LOADLIB
Action: release owner to validate approved package bind and plan package list.
Restart: pending review of application commit/checkpoint messages and OUTFILE catalog status.

The note avoids guessing. It captures the evidence needed by both batch support and the DB2/release team.

Common mistakes

Practical checklist

Before closing a -805 incident, verify:

Summary

DB2 SQLCODE -805 is best handled as a release-alignment investigation, not as a blind rerun or an automatic rebind. Read the complete message, establish the runtime plan and load module, compare the requested package identity with approved deployment artifacts, and use the correct ownership path to repair the mismatch.

For batch support, the job-restart decision is a separate but equally important step. Confirm commits, checkpoints, datasets, and downstream effects before resuming processing. This disciplined approach shortens recovery while protecting data quality and making future DB2 deployments easier to troubleshoot.

← Back to all articles