SEARCH function

Searches the directories and libraries defined in the PROPATH environment variable for a file. The SEARCH function returns the full pathname of the file unless it is found in your current working directory. If SEARCH does not find the file, it returns the Unknown value (?).

Syntax

SEARCH ( opsys-file )
opsys-file
A character expression whose value is the name of the file you want to find. The name can include a complete or partial directory path. If opsys-file is a constant string, you must enclose it in quotation marks (" "). The value of opsys-file must be no more than 255 characters long. The filename can contain Unicode characters. See OpenEdge Development: Internationalizing Applications for more information about Unicode.

Example

In this procedure, the SEARCH function returns the fully qualified pathname of the filename entered if it is not in the current working directory. If SEARCH cannot find the file, it returns the Unknown value (?). The procedure displays the fully qualified pathname or a message indicating that the file could not be found.

r-search.p

DEFINE VARIABLE fullname AS CHARACTER NO-UNDO FORMAT "x(55)".
DEFINE VARIABLE filename AS CHARACTER NO-UNDO FORMAT "x(20)".

REPEAT:
  UPDATE filename HELP "Try entering 'help.r' or 'dict.r'"
    WITH FRAME a SIDE-LABELS CENTERED.
    fullname = SEARCH(filename).
    IF fullname = ? THEN
      DISPLAY "UNABLE TO FIND FILE " filename
        WITH FRAME b ROW 6 CENTERED NO-LABELS.
    ELSE
      DISPLAY "Fully Qualified Path Name Of:" filename SKIP(2) 
        "is:" fullname WITH FRAME c ROW 6 NO-LABELS CENTERED.
END.

Notes