Debugging run-time error DB001009 Module not found, for an Access Module

Document ID : KB000053899
Last Modified Date : 14/02/2018
Show Technical Document Details


A DB001009 error at run-time indicates that a required module is not found. This document describes likely causes when the named module is an access module.


When a program or dialog contains SQL DML, a Relational Command Module (RCM) is automatically generated by the pre-compiler. This contains an encoded version of the logical SQL requests. To be executed at run-time, these must be parsed by the optimizer which will determine the optimal physical path which should be used to satisfy the logical requests. This path is stored in the Access Module (AM).

If at run-time the access module is not found, it can be due to one of a few reasons:

  1. An AM is created via a CREATE ACCESS MODULE statement using OCF or BCF. This is an additional required step after the program and/or dialog is compiled. If this step is not done, the DB001009 will result.

  2. At run-time, the program load module is loaded and searched for the name of the AM to load. If not otherwise specified to the pre-compiler, the default name for the AM will be the same name as the program. If a different name is specified on the CREATE ACCESS MODULE, but not identified to the pre-compiler, that can cause the DB001009 error.

  3. The default is for there to be a 1-to-1 relationship between programs and access modules. However, there must be only one AM per run-time application thread. So if multiple dialogs and/or programs link to one another within a single transaction, their RCMs must be combined into a single AM. The name of this AM must be provided to the pre-compiler for each of the components, so that the correct AM will be loaded at run-time. If that does not happen, the DB001009 will result.

  4. The CREATE ACCESS MODULE statement requires that an AM name must be qualified by a schema name. However, when providing an AM name to the pre-compiler, it must be specified without that qualifying schema name. Coding the pre-compiler option with a schema name as qualifier for the AM can also cause the DB001009. The pre-compiler AM=parm should specify the unqualified name of the access module,
    not the qualified name; i.e. no schema name should be specified.

  5. The CREATE ACCESS MODULE will store the AM in the DDLCATLOD area of the catalog. That area must be available to the run-time transaction within the DBname in which it is executing. If it is not, the DB001009 can result.

    These are the most common causes for the DB001009 error.