PreviousForms-2 On-line Help SystemNext"

Chapter 9: Library: Command Line Interface

This chapter describes the Library utility, which groups individual files into one file. You also can use Library to group together static source code to create copylibraries.

9.1 Overview

Using Library gives you the following advantages:

Warning: Files in libraries are read-only; you cannot access them via WRITE or REWRITE. Trying to open such a file using OPEN OUTPUT or OPEN I-O will open a file outside the library, then WRITE or REWRITE will update this file leaving the file in the library unchanged.

9.2 Operation

Library is invoked from the operating system command line and runs in batch mode. The following sections describe how to invoke Library, how to create a Library batch file and how to access files in libraries.

9.2.1 Invoking Library

To invoke Library, enter:

library file-name-1 [file-name-2...] [==library-name]

where the parameters are:

file-name-n Either a file to be included in the library, a library whose contents are to be included, or a library batch file (see below).
library-name The library to be saved. If this is not specified the library, takes the name of the first parameter, thus file-name-1.lbr.

file-name-n and library-name can include drive and/or path. If these are unspecified the current directory is assumed.

If you specify a .lbr library file as a file-name-n, the new library includes all the files contained in the old library.

For libraries that you are going to create and recreate frequently, you can write a library batch file (.lbt file) which contains the list of files to be included in the library. See the section Creating a Library Batch File below.

If an overlayed program is in a library, all the overlays must be in the same library as the program root segment.

Because file-name can include a library name as part of the path, you can use the Library Utility to copy files from one or more existing libraries into a new library. This is especially useful if you need to ship an application program that uses files supplied in utils.lbr; you can copy the necessary files from utils.lbr into a library of your own to ship with your application program. You must give the name of the new library by using the library-name parameter.


library $COBDIR/utils.lbr/linein.gnt == mylib.lbr

9.2.2 Creating a Library Batch File

Batch files can be used with the load function to save you entering file-names individually. To create a batch file, enter the COBOL Editor; type one file-name on each line in the file starting at column one; then save the file using a .lbt extension. This file contains the file-names only, not the actual files.

To run a library batch file, enter:

library batch.lbt == library-name

where the parameters are:

batch.lbt The file you have just created, containing the list of files to be included in the library.
library-name As described previously. However, in this case, if you do not specify, library-name, the library is assigned the name batch.lbr.

You can prefix any of the file-names with a path-name identifier.

9.2.3 Accessing Files in Libraries

The following program operations obtain access to files in libraries:

Files within libraries can be found only if the library is open. There are several ways to open a library:


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousForms-2 On-line Help SystemNext"