How to access a DB2 database from a CA IDMS batch program?
search cancel

How to access a DB2 database from a CA IDMS batch program?

book

Article ID: 53470

calendar_today

Updated On:

Products

IDMS IDMS - Database IDMS - ADS

Issue/Introduction

For sites with both CA-IDMS and DB2 databases, there may be a need to access both from within the same batch program. This is possible, but there are some limitations. This document provides details as to what can be accomplished and how.

 

Environment

IDMS - all supported releases

Resolution

It is possible to access DB2 data from within a CA IDMS program. However, there are some limitations in writing such a program. First, a single DML statement cannot reference data sources from both CA IDMS and DB2. Each DML statement must reference either a CA IDMS data source or a DB2 table, but not both. Second, if the program contains network DML for a CA IDMS database and SQL DML for a DB2 database, then these steps must be taken to compile the program:

  1. Run the program through IDMS precompiler, specifying the parm SQL=DISABLED. This parm was added to the precompilers in release 12.0; if specified, this instructs the precompiler not to process any SQL statements in the program. This can be useful if the program contains nonSQL DML and DB2 SQL. Since IDMS has its own set of SQL now, errors would be received when trying to process DB2 SQL commands.

  2. Run the program through the DB2 precompiler, to resolve the DB2 SQL DML statements.

  3. Compile and link the program;

  4. Follow normal steps to produce the executable run-time module containing the DB2 access path.

A program compiled and linked in this way can run in batch mode to access both CA IDMS and DB2 databases.

In addition to the compile-time considerations, certain run-time restrictions are imposed by the DB2 architecture. When executing a program to access DB2, DB2 must be in control of the address space in order to access the DB2 database. This means you must initiate DB2 which then loads and executes the program under DB2 control. If a user has a batch program that needs to access both DB2 and IDMS it is necessary for the user to engage DB2 and have it control the program. Then that program can issue calls to CA IDMS and access a CA IDMS CV as an external run-unit or can start up a local mode CA IDMS run-unit (assuming DB2 has left enough of the address-space for IDMS to initialize).

If the program must run on-line, the following options are possible:

  1. Use a CICS-driven interface to access both CA IDMS and DB2;

  2. Initiate the task with DB2 instead of within CA IDMS, and let the DB2 program access IDMS as outlined above;

As noted above, there is no direct way to access a DB2 database from a program running within the IDMS CV, because of the restriction imposed by the DB2 architecture.