[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

In Figure 8-1, the repository is named SALES (USA and GERMANY are not used). ANCHOR is the starting directory for the full repository pathname. Repository directories are analogous to OpenVMS Alpha and I64 subdirectories. They catalog other repository directories or repository objects, and they are labeled by the paths through the hierarchy that lead to them.

The repository objects are named PAYROLL and INVENTORY. These objects are the named record descriptions stored in Oracle CDD/Repository, and they form the end-points of the repository hierarchy branches. The examples that follow copy these record descriptions.

The full repository pathname provides a unique designation for every directory and object in Oracle CDD/Repository hierarchy. It traces the paths from ANCHOR to the directory or object.

For information on how to create and maintain a hierarchical structure in Oracle CDD/Repository, refer to the Oracle CDD/Repository documentation set.

Note

Not all Oracle CDD/Repository data types are valid HP COBOL data types. See the Technical Notes.

Example 8-7 shows how to use a command file to create the repository directories and objects shown in Figure 8-1 using CDO.

Example 8-7 Command File That Creates Oracle CDD/Repository Directories and Objects in Figure 8-1 (OpenVMS)

define field name
    datatype is text
    size 30.
define field address
    datatype is text
    size is 40.
define field salesman_id
    datatypes is text
    size is 5.
define record salesman.
    name.
    address.
    salesman_id.
end record.
define field ytd_sales
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define field ytd_commission
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define field curr_month_sales
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define field curr_month_commission
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define field curr_week_sales
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define field curr_week_commission
    datatype is right overpunched numeric
    size is 11 digits
    scale -2.
define record payroll_record.
    salesman.
    ytd_sales.
    ytd_commission.
    curr_month_sales.
    curr_month_commission.
    curr_week_sales.
    curr_week_commission.
end record.
define field part_number
    datatype is right overpunched numeric
    size is 6 digits.
define field quantity_on_hand
    datatype is right overpunched numeric
    size is 9 digits.
define field quantity_on_order
    datatype is right overpunched numeric
    size is 9 digits.
define field retail_price
    datatype is right overpunched numeric
    size is 8 digits
    scale -2.
define field wholesale_price
    datatype is right overpunched numeric
    size is 8 digits
    scale -2.
define field supplier
    datatype is text
    size is 5 characters.
define record inventory_record.
    part_number.
    quantity_on_hand.
    quantity_on_order.
    retail_price.
    wholesale_price.
    supplier.
end record.

Example 8-8 shows the results of copying the repository object PAYROLL in Figure 8-1. The program defines the logical name payroll to be equivalent to the full Oracle CDD/Repository pathname DEVICE:[DIRECTORY.ANCHOR]. Line 27 of the program shows the DCL command used to define the logical name and line 30 contains the COPY FROM DICTIONARY statement.

On OpenVMS Alpha and I64 systems, the COPY statement produces lines 31 to 44 in your program listing if you include the /COPY_LIST compiler option. Line 32 is the resulting full Oracle CDD/Repository pathname used by the compiler. Lines 31 and 33 are separator comment lines. Lines 34 to 44 are the COBOL compiler-translated record description entries taken from the PAYROLL repository object in Oracle CDD/Repository.

Example 8-8 Using a Logical Name in a COPY Statement (OpenVMS)

              1 IDENTIFICATION DIVISION.
              2 PROGRAM-ID.  TEST-CDD.
              3 *
              4 *   Copy from CDD/Repository
              5 *   FILE SECTION
              6 *           Records:    PERSONNEL
              7 *                       INVENTORY
              8 *                       PAYROLL
              9 *
             10 *   WORKING-STORAGE SECTION
             11 *           Records:    SYDNEY
             12 *                       MAPLE
             13 *                       FRENCH
             14 *
             15 ENVIRONMENT DIVISION.
             16 INPUT-OUTPUT SECTION.
             17 FILE-CONTROL.
             18     SELECT SALES-CDD-FILE
             19     ASSIGN TO "CDD.TMP".
             20 DATA DIVISION.
             21 FILE SECTION.
             22 FD SALES-CDD-FILE.
             23 *
             24 *   To create a logical name entry for the repository object
             25 *   PAYROLL, use this command:
             26 *
             27 *   $ DEFINE PAYROLL_RECORD "DEVICE:[DIRECTORY.ANCHOR]SALES.PAYROLL"
             28 *
             29 *
             30     COPY PAYROLL FROM DICTIONARY.
L            31 *
L            32 * _DEVICE:[DIRECTORY.ANCHOR]PAYROLL_RECORD
L            33 *
L            34 01  PAYROLL_RECORD.
L            35     02  SALESMAN.
L            36         03  NAME            PIC X(30).
L            37         03  ADDRESS         PIC X(40).
L            38         03  SALESMAN_ID     PIC X(5).
L            39     02  YTD_SALES           PIC S9(9)V9(2) SIGN TRAILING.
L            40     02  YTD_COMMISSION      PIC S9(9)V9(2) SIGN TRAILING.
L            41     02  CURR_MONTH_SALES    PIC S9(9)V9(2) SIGN TRAILING.
L            42     02  CURR_MONTH_COMMISSION PIC S9(9)V9(2) SIGN TRAILING.
L            43     02  CURR_WEEK_SALES     PIC S9(9)V9(2) SIGN TRAILING.
L            44     02  CURR_WEEK_COMMISSION PIC S9(9)V9(2) SIGN TRAILING.
             45
             46     COPY "DEVICE:[DIRECTORY.ANCHOR]INVENTORY_RECORD" FROM DICTIONARY.
L            47 *
L            48 * _DEVICE:[DIRECTORY.ANCHOR]INVENTORY_RECORD
L            49 *
L            50 01  INVENTORY_RECORD.
L            51     02  PART_NUMBER         PIC S9(6) SIGN TRAILING.
L            52     02  QUANTITY_ON_HAND    PIC S9(9) SIGN TRAILING.
L            53     02  QUANTITY_ON_ORDER   PIC S9(9) SIGN TRAILING.
L            54     02  RETAIL_PRICE        PIC S9(6)V9(2) SIGN TRAILING.
L            55     02  WHOLESALE_PRICE     PIC S9(6)V9(2) SIGN TRAILING.
L            56     02  SUPPLIER            PIC X(5).
             57
             58
        ...

Example 8-9 shows the results of copying a repository object INVENTORY by specifying its full Oracle CDD/Repository pathname.

In Example 8-9, line 44 contains the COPY FROM DICTIONARY statement. On OpenVMS Alpha and I64 systems, this COPY statement produces lines 45 to 54 in your program listing if you include the /COPY_LIST compiler option. Line 46 is the resulting full Oracle CDD/Repository pathname used by the compiler. Lines 45 and 47 are separator comment lines. Lines 48 to 54 are the compiler-translated record description entries taken from the inventory repository object in Oracle CDD/Repository.

Example 8-9 Using a Full Pathname in a COPY Statement (OpenVMS)

       44      COPY "DEVICE:[DIRECTORY.ANCHOR]SALES.INVENTORY" FROM DICTIONARY.
L      45 *
L      46 * DEVICE:[DIRECTORY.ANCHOR]SALES.INVENTORY
L      47 *
L      48 01  INVENTORY_RECORD.
L      49      02  PART_NUMBER               PIC 9(6).
L      50      02  QUANTITY_ON_HAND          PIC S9(9) SIGN TRAILING.
L      51      02  QUANTITY_ON_ORDER         PIC S9(9) SIGN TRAILING.
L      52      02  RETAIL_PRICE              PIC S9(6)V9(2) SIGN TRAILING.
L      53      02  WHOLESALE_PRICE           PIC S9(6)V9(2) SIGN TRAILING.
L      54      02  SUPPLIER                  PIC X(5).

Figure 8-2 shows a nonhierarchical repository structure. In this example, fields NAME and ADDRESS are used by both the EMPLOYEE-RECORD and the CUSTOMER-RECORD. As such, they are defined in a separate directory (COMMON_FIELD_DEFINITIONS). The fields PART and PART_NUMBER are used exclusively by the INVENTORY_RECORD. As such, they are defined in the INVENTORY directory. This functionality is only available in CDO formatted repositories.

Figure 8-2 Nonhierarchical Repository Structure (OpenVMS)


Example 8-10 shows how to use a CDO command file to create the directories and objects shown in Figure 8-2 using CDO. The CDO file is executed from within CDO using the following command:


$ REPOSITORY
CDO>@FILENAME.CDO

Example 8-10 Command File That Creates Oracle CDD/Repository Directories and Objects in Figure 8-2 (OpenVMS)

DEFINE DICTIONARY DEVICE:[DIRECTORY.ANCHOR].
SET DEFAULT DEVICE:[DIRECTORY.ANCHOR]
DEFINE DIRECTORY EMPLOYEE.
DEFINE DIRECTORY CUSTOMER.
DEFINE DIRECTORY INVENTORY.
DEFINE DIRECTORY COMMON_FIELD_DEFINITIONS.
SET DEFAULT DEVICE:[DIRECTORY.ANCHOR]COMMON_FIELD_DEFINITIONS
DEFINE FIELD NAME DATATYPE IS TEXT SIZE IS 25 CHARACTERS.
DEFINE FIELD ADDRESS DATATYPE IS TEXT SIZE IS 47 CHARACTERS.
SET DEFAULT DEVICE:[DIRECTORY.ANCHOR]EMPLOYEE
DEFINE FIELD DATE_OF_HIRE DATATYPE IS UNSIGNED NUMERIC SIZE IS 8 DIGITS.
DEFINE FIELD SEX DATATYPE IS TEXT SIZE IS 1 CHARACTER.
DEFINE FIELD DEPENDENTS DATATYPE IS UNSIGNED NUMERIC SIZE IS 2 DIGITS.
DEFINE RECORD EMPLOYEE_RECORD.
[DIRECTORY.ANCHOR]COMMON_FIELD_DEFINITIONS.NAME.
[DIRECTORY.ANCHOR]COMMON_FIELD_DEFINITIONS.ADDRESS.
DATE_OF_HIRE.
SEX.
DEPENDENTS.
END RECORD.
SET DEFAULT DEVICE:[DIRECTORY.ANCHOR]CUSTOMER
DEFINE FIELD BUSINESS_TYPE DATATYPE IS TEXT SIZE IS 25 CHARACTERS.
DEFINE FIELD CONTACT_PERSON DATATYPE IS TEXT SIZE IS 25 CHARACTERS.
DEFINE RECORD CUSTOMER_RECORD.
[DIRECTORY.ANCHOR]COMMON_FIELD_DEFINITIONS.NAME.
[DIRECTORY.ANCHOR]COMMON_FIELD_DEFINITIONS.ADDRESS.
BUSINESS_TYPE.
CONTACT_PERSON.
END RECORD.
SET DEFAULT DEVICE:[DIRECTORY.ANCHOR]INVENTORY
DEFINE FIELD PART DATATYPE IS TEXT SIZE IS 25 CHARACTERS.
DEFINE FIELD PART_NUMBER DATATYPE IS TEXT SIZE IS 10 CHARACTERS.
DEFINE RECORD INVENTORY_RECORD.
PART.
PART_NUMBER.
END RECORD.                                              <>


Previous Next Contents Index