Compaq COBOL AAQ2G1FTK User Manual

Page 582

Advertising
background image

Programming Productivity Tools
C.6 Using Oracle CDD/Repository (OpenVMS)

C.6.2 Accessing Oracle CDD/Repository Definitions from Compaq COBOL

Programs

You access repository data definitions from a COBOL program using the COPY
FROM DICTIONARY statement. At compile time, the record definition and
its attributes are extracted from the designated repository. Then the compiler
converts the extracted definition into a COBOL declaration. For example, the
following COBOL statements access the customer and employee address records
defined earlier. These definitions have been placed in the repository directory
DEVICE:[VMS_DIRECTORY]SALES.

IDENTIFICATION DIVISION.
PROGRAM-ID. MASTER-FILE.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY "DEVICE:[VMS_DIRECTORY]SALES.CUSTOMER_ADDRESS_RECORD" FROM DICTIONARY.
COPY "DEVICE:[VMS_DIRECTORY]SALES.EMPLOYEE_ADDRESS_RECORD" FROM DICTIONARY.

.
.
.

If you compile this program with the /LIST and /COPY_LIST qualifiers, the
source listing includes the data definition translated into a COBOL declaration,
as shown in the following example:

1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. MASTER-FILE.
3 DATA DIVISION.
4 WORKING-STORAGE SECTION.
5 COPY "DEVICE:[VMS_DIRECTORY]SALES.CUSTOMER_ADDRESS_RECORD" FROM DICTIONARY.

L

6 *

L

7 *DEVICE:[VMS_DIRECTORY].SALES.CUSTOMER_ADDRESS_RECORD

L

8 *

L

9 01 CUSTOMER_ADDRESS_RECORD.

L

10

02 NAME

PIC X(25).

L

11

02 COMPANY_NAME

PIC X(25).

L

12

02 STREET

PIC X(20).

L

13

02 CITY

PIC X(20).

L

14

02 STATE

PIC X(2).

L

15

02 ZIP

PIC X(5).

16 COPY "NODE::DEVICE:[VMS_DIRECTORY]SALES.EMPLOYEE_ADDRESS_RECORD" FROM DICTIONARY.

L

17 *

L

18 *DEVICE:[VMS_DIRECTORY].SALES.EMPLOYEE_ADDRESS_RECORD

L

19 *

L

20 01 EMPLOYEE_ADDRESS_RECORD.

L

21

02 NAME

PIC X(25).

L

22

02 STREET

PIC X(20).

L

23

02 CITY

PIC X(20).

L

24

02 STATE

PIC X(2).

L

25

02 ZIP

PIC X(5).

.
.
.

For more information on the COPY FROM DICTIONARY statement, refer to
the Compaq COBOL Reference Manual. For more information on the /LIST and
/COPY_LIST command qualifiers, invoke the online HELP facility for COBOL at
the operating system prompt.

C–18 Programming Productivity Tools

Advertising