DDM files and SQL

 

You can use i5/OS® distributed data management (DDM) support to help you do some distributed relational database tasks within a program that also uses SQL distributed relational database support.

It might be faster, for example, for you to use DDM and the Copy File (CPYF) command to get a large number of records rather than an SQL FETCH statement. Also, DDM can be used to get external file descriptions of the remote system data brought in during compilation for use with the distributed relational database application. To do this, use DDM as described in Initial setup. The following example shows how you can add a relational database directory entry and create a DDM file so that the same job can be used on the application server (AS) and application requester (AR). Notes:

Relational Database Directory:
 
ADDRDBDIRE    RDB(KC000) +
              RMTLOCNAME(KC000)
              TEXT('Kansas City regional database')
DDM File:
 
CRTDDMF  FILE(SPIFFY/UPDATE)
         RMTFILE(SPIFFY/INVENTORY)
         RMTLOCNAME(KC000)
         TEXT('DDM file to update local orders')

Here is a sample program that uses both the relational database directory entry and the DDM file in the same job on the remote system:

 
CRTSQLxxx PGM(PARTS1) COMMIT(*CHG)  RDB(KC000) RDBCNNMTH(*RUW)
 
    PROC :PARTS1;
    OPEN  SPIFFY/UPDATE;
       .
       .
       .
    CLOSE SPIFFY/UPDATE;
       .
       .
       .
    EXEC SQL       SELECT * INTO :PARTAVAIL                FROM INVENTORY                WHERE ITEM = :PARTNO;
    EXEC SQL       COMMIT;
       .
       .
       .
    END PARTS1;

 

Parent topic:

Programming considerations for a distributed relational database application

 

Related concepts


Distributed data management

 

Related reference


Copy File (CPYF) command