Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## LIBRARY function

> Parses a character string in the form `path-name<<member-name>>`, where `path-name` is the pathname of a Progress r-code library and `member-name` is the name of a file within the library, and returns the pathname of the library. The double angle brackets indicate that `member-name` is a file in a library. If the string is not in this form, the LIBRARY function returns the Unknown value (`?`).

> Typically, you use the LIBRARY function with the SEARCH function to retrieve the name of a library. The SEARCH function returns character strings of the form `path-name<<member-name>>` if it finds a file in a library.

> #### Syntax

>     LIBRARY ( string )

> ``string``

> A character expression whose value is the pathname of a file in a library.

> Example

> This procedure searches for a file that you specify. It displays a message indicating whether the file is not found in your path, is found in a library within your path, or is found in your path but not in a library.

> r-rlib.p
>     DEFINE VARIABLE what-lib AS CHARACTER.
>     DEFINE VARIABLE location AS CHARACTER.
>     DEFINE VARIABLE myfile   AS CHARACTER FORMAT "x(16)" LABEL "R-code File".

>     SET myfile.
>     location = SEARCH(myfile).

>     IF location = ?
>     THEN DO:
>        MESSAGE "Can’t find" myfile.
>        LEAVE.
>     END.

>     what-lib = LIBRARY(location).
>     IF what-lib <> ?
>     THEN MESSAGE myfile "can be found in library" what-lib.
>     ELSE MESSAGE myfile "is not in a library but is in" location.

> #### Note

> You can improve the performance of an application by using the SEARCH and LIBRARY functions to build absolute or relative pathnames for the files you want to execute several times with the RUN statement. Passing full or relative pathnames to the RUN statement avoids the need to search the `PROPATH` each time.

> #### See also

> MEMBER function, SEARCH function

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095