Previous Topic: Creating the Access ModuleNext Topic: Altering an Access Module


Overriding Access Module Defaults

Access Module Name Qualifier

Qualify the access module name if you want to associate the access module with a schema that is not the default for the SQL session in which the CREATE ACCESS MODULE statement is issued.

Ownership of the schema that qualifies the access module affects authority to use the access module under CA IDMS internal security. The owner of the schema must have authority to execute the statements in the access module, and the authorities must be grantable for another user to execute the access module.

Note: For more information and specific rules regarding schema ownership and authority to execute access modules under CA IDMS security, see the CA IDMS Security Administration Guide.

Access Module Version Number

Specify an access module version number according to site standards.

You can use the version number of the access module to represent the version of the application that you want to execute at runtime.

Note: For more information, see Executing the Application.

Schema-name Mapping for Tables and Views

Supply schema-name mapping to specify a qualifier that should replace a table or view qualifier in the RCMs that the access module contains. Schema-name mapping allows you to specify the database that the access module accesses.

In this example, unqualified table and view names, and table and view names qualified with EMP_SCH, are mapped to a schema called EMP_TSTSCH. When the access module executes, a reference to the EMPLOYEE table or the EMP_SCH.EMPLOYEE will change to the EMP_TSTSCH.EMPLOYEE table:

EXEC SQL
  CREATE ACCESS MODULE EMPINFO1
     FROM EMPDICT.EMPDSP01,
          EMPDICT.EMPDSP02,
          EMPDICT.EMPDSP03,
          EMPDICT.EMPADD01,
          EMPDICT.EMPUPD01,
          EMPDICT.EMPUPD02,
          EMPDICT.EMPDEL01
     MAP EMP_SCH TO EMP_TSTSCH,    ◄─── Schema-name mapping
     MAP NULL TO EMP_TSTSCH
END-EXEC.

You can subsequently change the schema-name mapping by creating a new access module or altering an existing one. This lets you change the database that the application accesses without precompiling the programs again.

Note: For more information about altering an access module, see Altering an Access Module.

Automatic Access Module Re-creation

At runtime, if the DBMS detects that the database definition of a table specified in the access module has changed since the access module was created, it automatically recreates the access module unless the access module was defined with AUTO RECREATE OFF.

If the AUTO RECREATE option is OFF at runtime, the DBMS returns an error with an SQLCERC value of 1014.

Table Definition Timestamp Validation

The DBMS validates the definition timestamp of every table accessed by statements in the access module before executing the access module unless you specify VALIDATE BY RCM or VALIDATE BY STATEMENT. Validation failure is a condition that requires re-creation of the access module.

BY RCM causes validation only for tables accessed by statements in the RCM to be executed. BY STATEMENT causes validation only for tables accessed by the statement to be executed.

One of these specifications may be appropriate if the application contains sections of code that are infrequently executed.

Transaction State

The default transaction state is READ WRITE unless you specify the READ ONLY parameter. READ ONLY will cause an error to be returned at runtime attempts to perform an update. The combination of READ ONLY and a ready mode of update will cause an error when you create the access module (see Ready mode).

A program can override the transaction state specified for the access module with the SET TRANSACTION statement.

SET TRANSACTION must precede most statements in the transaction. For more information, see the CA IDMS SQL Reference Guide.

A transaction with an isolation level of transient read is automatically a READ ONLY transaction. A specification of READ WRITE for the access module or the transaction is ignored when the isolation level of the transaction is transient read.

Isolation Level

Specify the DEFAULT ISOLATION parameter only if cursor stability is not the appropriate isolation level for executing the application.

Note: For more information about the effect of isolation level, see Writing an SQL Program.

Ready Mode

With the READY parameter, you can specify ready mode for one, some, or all areas.

Ready mode refers to the type of area lock the DBMS sets for the database transaction. The effect of the area lock differs depending on whether the execution environment is the central version or local mode. For example, for a program running under the central version, a ready mode of protected retrieval prevents concurrent transactions from updating data in the area, but for a local mode program, it does not prevent concurrent updates.

If you specify the PRECLAIM option for an area, the DBMS sets area locks on the first database access statement (to any area) in the transaction. If you do not specify PRECLAIM for an area, the default is INCREMENTAL, meaning that the area lock is set on the first access to that area.

Default Ready Mode

You should accept the default ready mode unless experience proves there is a reason to override it.

Note: For more information about ready mode options, see:

Actual Ready Mode

The actual ready mode at runtime depends on the interaction of transaction state, specified ready mode, and the status of the area (initially defined in the DMCL).

The following two tables present the actual ready mode in each possible interaction.

READ ONLY Ready Modes

This table presents the actual ready modes when the transaction state is READ ONLY:

Specified ready mode

Area status

Actual ready mode

(No specification)

Transient retrieval

Retrieval

Update

Transient retrieval

Shared retrieval

Shared retrieval

Any retrieval mode

Transient retrieval

Retrieval

Update

Transient retrieval

As specified

Shared retrieval

Any update mode

Transient retrieval

Retrieval

Update

Transient retrieval

Shared retrieval

Shared retrieval

READ WRITE Ready Modes

This table presents the actual ready modes when the transaction state is READ WRITE:

Specified ready mode

Area status

Actual ready mode

(No specification)

Transient retrieval

Retrieval

Update

Transient retrieval

Shared retrieval

Shared update

Any retrieval mode

Transient retrieval

Retrieval

Update

Transient retrieval

As specified

As specified

Any update mode

Transient retrieval

Retrieval

Update

(Runtime error)

(Runtime error)

As specified