COPY Libraries [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
COPY Libraries
The COPY statement is a COBOL feature that enables you to copy COBOL
source statements into your program from COPY Libraries. In this way,
multiple programs can use a single paragraph, file description or record
description.
On an HP computer system, COBEDIT copy libraries are KSAM files of ASCII
records which contain one or more modules. These modules are the sets of
text which can be copied into your program. You can have more than one
library and, by using multiple COPY statements, can copy text from
several libraries.
A module in a copy library is distinguished from other modules by a
string of alphanumeric characters in columns 73 through 80 of each record
in that module. Since this is the only way to distinguish one module
from another, the string of characters must be unique with respect to
every other module in the same library.
The following illustrates the use of the COBEDIT program to list three
modules within a library named MYLIB:
:RUN COBEDIT.PUB.SYS
HP32233A.02.00 COPYLIB EDITOR - COBEDIT MON, MAR 26, 1991, 10:08 AM
(C) HEWLETT-PACKARD CO. 1986
TYPE "HELP" FOR A LIST OF COMMANDS.
>LIBRARY MYLIB
>LIST ALL
Text-name MODULE1
001000$CONTROL SUBPROGRAM
001100 IDENTIFICATION DIVISION.
001200 PROGRAM-ID. DUMMY-SUB.
Text-name MODULE2
005100 WORKING-STORAGE SECTION.
005200 01 UNIV-TOTALER PIC 9(8) COMP-3.
005300 01 UNIV-ACCUM PIC 9(8) COMP-3.
Text-name MODULE3
008000 PERFORM TEST-IT.
008100 IF RESULTANT IS LESS THAN 2
008200 PERFORM TEST-FAILED;
008300 ELSE NEXT SENTENCE.
The three modules are MODULE1, MODULE2, and MODULE3. There is no
restriction on a module name. The names above were chosen to help
clarify the example.
MPE/iX 5.0 Documentation