In this section: |
The Adapter for DB2 not only allows FOCUS MODIFY procedures to view and/or update data residing in DB2 tables, it also gives them read-only access to IMS data sources. You can issue FIND and LOOKUP commands against IMS data sources and use MATCH and NEXT commands to display IMS data. FOCUS can access data from both DB2 and IMS transparently, postponing or eliminating the need to physically move IMS files to DB2.
Read-only access to IMS data from DB2 MODIFY procedures requires installation of the Adapter for IMS/DB in addition to the Adapter for DB2. Both products are available from Information Builders. See the appropriate installation documentation for installation instructions.
Note:
How to: Reference: |
MODIFY commands accessing IMS data behave similarly to MODIFY commands accessing the FOCUS DBMS. If you are not familiar with FOCUS MODIFY commands, consult Maintaining Tables With FOCUS and your FOCUS documentation on maintaining databases.
If an IMS data source participates in a COMBINE structure with a DB2 table, the MODIFY MATCH, NEXT, REPOSITION, and FIND commands can access the IMS data. If you dynamically JOIN the IMS file to a DB2 Master File, you can LOOKUP data values in the IMS file. The following sections discuss these two techniques.
If you COMBINE the IMS data source with a DB2 table, several MODIFY subcommands can access the IMS data. The syntax is
COMBINE FILES file1 [PREFIX pref1|TAG tag1] [AND] . . . filen [PREFIX prefn|TAG tagn] AS asname
where:
Are the Master File names of the tables you want to modify. You can specify up to 16 Master Files.
Are prefix strings for each file, up to four characters. They provide uniqueness for fieldnames. You cannot mix TAG and PREFIX in a COMBINE structure. Refer to your FOCUS documentation on maintaining databases for additional information.
Are aliases for the table names, up to eight characters. FOCUS uses the tag name as the table name qualifier for fields that refer to that table in the combined structure. You cannot mix TAG and PREFIX in a COMBINE.
Is an optional word to enhance readability.
Is the required name of the combined structure to use in MODIFY procedures and CHECK FILE commands.
Note:
Once you issue the COMBINE FILE command, you can access the IMS files in the structure with the following MODIFY commands:
The MATCH command selects specific segment instances based on their values. It compares field values in the instances with incoming data values.
The adapter passes a MATCH on a full key that is defined as .IMS, .HKY, or .KEY, directly to the IMS DBMS. This is the most efficient access method. The Adapter for IMS/DB issues a GET UNIQUE.
A MATCH on a non-key or partial key field repositions to the beginning of the chain and searches forward for the specified value. This search is not passed to the IMS DBMS and, therefore, is less efficient. The adapter issues GET NEXT commands until the match condition is met or no records remain.
When you specify a MATCH with both a key and a non-key field, the MATCH condition for the key is passed to the IMS DBMS for retrieval. Then the adapter does the sequential forward search for the non-key value. The adapter issues a GET UNIQUE for the qualified key, applies the condition for the non-key value based on the qualified key, and then issues GET NEXT commands for the qualified value.
The NEXT command selects the next segment instance after the current position, making the selected instance the new current position. The current position depends on the execution of the MATCH and NEXT commands:
NEXT processing with a MATCH command is identical to NEXT processing without a MATCH command. If a current position has not been established, the adapter issues a GET UNIQUE to retrieve the first record and then issues GET NEXT calls to retrieve remaining records.
NEXT processing after MATCH on a non-key or partial key produces the same results. It is important to realize that the MATCH on the non-key is not passed to the IMS DBMS. The adapter repositions from the beginning of the chain and searches forward until the condition is met. Therefore, for maximum efficiency, consider matching on the primary key.
The REPOSITION command sets the current position to the beginning of the IMS segment chain you are traversing or to the beginning of the chain of any of the parent instances along the segment path. Refer to your FOCUS documentation on maintaining databases for additional information.
The FIND function tests for the existence of indexed values in IMS data sources. COMBINE must be in effect in order to use FIND. Refer to your FOCUS documentation on maintaining databases for additional information.
You can also use the following MODIFY commands for DB2 tables in the COMBINE structure (refer to Maintaining Tables With FOCUS, for additional information):
The LOOKUP function retrieves data values from data sources joined dynamically by the JOIN command (see Advanced Reporting Techniques). When you join a DB2 Master File to an IMS file, you can LOOKUP either DB2 or IMS data.
You cannot issue LOOKUP if the MODIFY contains commands that require a COMBINE (for example, FIND of IMS or DB2 data), or if it contains MATCH and/or NEXT commands against IMS data.
LOOKUP for IMS data sources supports the extended syntax parameters GE and LE, while LOOKUP for DB2 data does not. Refer to your FOCUS documentation for additional information. Also consult Advanced Reporting Techniques, and Maintaining Tables With FOCUS, of this manual, and the FOCUS IMS/DB Data Adapter documentation.
After the Adapters for IMS/DB and DB2 are installed, you must create a CLIST or JCL to invoke this feature. Subsequent sections outline JCL and CLIST preparation.
The following JCL runs a batch FOCUS job that uses both the Adapters for IMS/DB and DB2 to provide read-only access to IMS data sources during update of DB2 tables. You must concatenate the FOCLIB.LOAD library into the allocations for DDNAME STEPLIB since the IMS software program, DFSRRC00, searches STEPLIB only for libraries that are called. You can concatenate the Adapter for IMS/DB module, IMS, with DDNAME STEPLIB or USERLIB.
This JCL is only a model. Before executing it, you must create an appropriate job card and modify the JCL to conform to your site's specifications
//JOB card goes here //BATIMS EXEC PGM=DFSRRC00,PARM='DLI,FOCUS,PSBNAME' //STEPLIB DD DISP=SHR,DSN=prefix.FOCLIB.LOAD DISP=SHR,DSN=DSN910.SDSNLOAD //USERLIB DD DISP=SHR,DSN=prefix.IMS.LOAD DD DISP=SHR,DSN=prefix.FOCSQL.LOAD DD DISP=SHR,DSN=prefix.FOCLIB.LOAD DD DISP=SHR,DSN=prefix.FUSELIB.LOAD //DFSRESLB DD DISP=SHR,DSN=IMSVS.RESLIB //ERRORS DD DISP=SHR,DSN=prefix.ERRORS.DATA DISP=SHR,DSN=prefix.IMS.DATA //IMS DD DISP=SHR,DSN=user.DBDLIB DD DISP=SHR,DSN=user.PSBLIB //FOCPSB DD DISP=SHR,DSN=user.FOCPSB(PSBNAME) //MASTER DD DISP=SHR,DSN=user.MASTER.DATA //FOCSQL DD DISP=SHR,DSN=user.FOCSQL.DATA //FOCEXEC DD DISP=SHR,DSN=user.FOCEXEC.DATA //SYSPRINT DD SYSOUT=A //SYSIN DD * FOCUS request goes here. For example, TABLE FILE imsfile PRINT field1 END FIN
where:
Is the high-level qualifier for your FOCUS production libraries.
Is the qualifier for a private version of a library.
Note: For a description of other IMS environments and their corresponding JCL requirements, see the Adapter for IMS/DB documentation.
You can use this feature interactively if you call it from a CLIST or REXX EXEC. You can allocate the FOCUS load libraries directly in your CLIST or REXX EXEC. This CLIST is only a model. Edit it to conform to your site's standards
PROC 0 CONTROL MSG NOLIST NOFLUSH ALLOC F(STEPLIB) DA('prefix.FOCLIB.LOAD') SHR REUSE ALLOC F(USERLIB) DA('prefix.IMS.LOAD' - 'prefix.FOCSQL.LOAD' - 'prefix.FOCLIB.LOAD' - 'prefix.FUSELIB.LOAD') SHR REUSE ALLOC F(DFSRESLB) DA('IMSVS.RESLIB') SHR REUSE ALLOC F(FOCEXEC) DA('user.FOCEXEC.DATA') SHR REUSE ALLOC F(MASTER) DA('user.MASTER.DATA') SHR REUSE ALLOC F(FOCSQL) DA('user.FOCSQL.DATA') SHR REUSE ALLOC F(ERRORS) DA('prefix.ERRORS.DATA' - 'prefix.IMS.DATA') SHR REUSE ALLOC F(FOCPSB) DA('user.FOCPSB(PSBNAME)') SHR REUSE ALLOC F(IMS) DA('user.PSBLIB' - 'user.DBDLIB') SHR REUSE CALL 'IMSVS.RESLIB(DFSRRC00)' 'DLI,FOCUS,PSB'
where:
Is the high-level qualifier for your FOCUS production libraries.
Is the high-level qualifier for a private version of a library.
Note: For a description of other IMS environments and their corresponding CLIST requirements, see the Adapter for IMS/DB documentation.
Information Builders |