MEMBER function

Parses a reference to a member of an ABL r-code library and returns the simple member name.

Syntax

MEMBER ( string ) 
string
A character expression (a constant, field name, variable or expression that results in a character value) whose value is the pathname of a file in an r-code library.

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

Use the MEMBER function with the SEARCH function to determine whether a file is in a library. If a data file is in a library, you must first extract the file from the library in order to read it. (See OpenEdge Deployment: Managing ABL Applications for more information on extracting a file from a library.) The SEARCH function returns a character string in the form path-name<<member-name>> if it finds a file in a library.

Example

This procedure prompts for the name of a file. Using this value, the procedure searches for the file. If it does not find the file, it displays a message and ceases operation. If it does find the file, it tests to see if the file is in a library. If so, the procedure displays the filename and the name of the library. Otherwise, the procedure displays the pathname of the file returned by SEARCH.

r-memb.p

DEFINE VARIABLE what-lib AS CHARACTER NO-UNDO.
DEFINE VARIABLE location AS CHARACTER NO-UNDO.
DEFINE VARIABLE myfile   AS CHARACTER NO-UNDO 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 MEMBER(location) "can be found in library" what-lib.
ELSE 
  MESSAGE myfile "is not in a library but is in" location.

See also

LIBRARY function, SEARCH function