For sites with both CA-IDMS and DB2 databases, there may be a need to access both from within the same program. This is possible, but there are some limitations. This document provides details as to what can be accomplished and how.
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:
- 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.
- Run the program through the DB2 precompiler, to resolve the DB2 SQL DML statements.
- Compile and link the program;
- 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:
- Use a CICS-driven interface to access both CA IDMS and DB2;
- Use the EDBC product (an ODBC/ JDBC-based CA server product) to access both;
- Use LU6.2 for program-to-program calls, either in native mode APPC or using a Send/receive option;
- Use a 3rd-party product to handle the dual-database access and coordination;
- 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.