ILE COBOL Programmer's Guide

Examples of Processing Distributed Files

In order to create a distributed file, you must do the following on each system on which parts of the distributed file will exist:

  1. You need to add a relational database directory entry for the local system, and one relational database directory entry for every other system that is going to contain part of the file
  2. You have to create the library that will contain the distributed file.

For the primary system, you need to do the following:

  1. Create a node group which contains the names of all of the relational databases involved
  2. Define the DDS for the physical file
  3. Create the physical file specifying the Node Group (NODGRP) and Partitioning Key (PTNKEY) parameters
  4. If you create a logical file over the distributed physical file, a distributed logical file results.

For example, suppose you have two systems, and you want each one to contain part of a distributed file. Assume:

To create the relational database directory entries on system OS400SYS1, you would enter the following commands:

  ADDRDBDIRE RDB(OS400SYS1) RMTLOCNAME(*LOCAL)
             TEXT('local database RDB directory entry')
  ADDRDBDIRE RDB(OS400SYS2) RMTLOCNAME(AS400SYS2)
             TEXT('remote database RDB directory entry') 

To create the library DISTRIBUTE on OS400SYS1, enter the CRTLIB command.

To create the relational database directory entries on system OS400SYS2, you would enter the following commands:

  ADDRDBDIRE RDB(OS400SYS2) RMTLOCNAME(*LOCAL)
             TEXT('local database RDB directory entry')
  ADDRDBDIRE RDB(OS400SYS1) RMTLOCNAME(AS400SYS1)
             TEXT('remote database RDB directory entry') 

To create the library DISTRIBUTE on OS400SYS2, enter the CRTLIB command.

On your primary system, assume:

Then, to create the node group on system OS400SYS1, use the following command:

   CRTNODGRP NODGRP(DISTRIBUTE/NODEGROUP) RDB(OS400SYS1 AS400SYS2)
             TEXT('node group for distributed file')

The DDS for the Create Physical File (CRTPF) command (contained in source file QDDSSRC, in library DISTRIBUTE) is:



 ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
      A          R CUSTREC
      A            CUSTOMERNO     9S 0       ALIAS(CUSTOMER_NUMBER)
      A            FIRSTNAME     15A         ALIAS(CUSTOMER_FIRST_NAME)
      A            LASTNAME      15A         ALIAS(CUSTOMER_LAST_NAME)
      A            ADDRESS       20A         ALIAS(CUSTOMER_ADDRESS)
      A            ACCOUNTNO      9S 0       ALIAS(CUSTOMER_ACCOUNT_NUMBER)

The DDS field CUSTOMERNO is used below as the partitioning key for the distributed file.

   CRTPF FILE(DISTRIBUTE/CUSTMAST)
         SRCFILE(DISTRIBUTE/QDDSSRC) SRCMBR(CUSTMAST)
         NODGRP(DISTRIBUTE/NODEGROUP)
         PTNKEY(CUSTOMERNO)

When the Create Physical File (CRTPF) command completes on the primary system, the file is created on the primary system as well as on all of the other relational databases in the node group. After the file has been created, changes to the node group will no longer affect the distributed file.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]