Progress
Language Reference


SEARCH Function

Interfaces
OS
SpeedScript
All
All
Yes

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 an unknown value (?).

SYNTAX

SEARCH ( opsys-file ) 

opsys-file

A character expression whose value is the name of the file that you want to search. 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 60 characters long.

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 an 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 FORMAT "x(55)".
DEFINE VARIABLE filename AS CHARACTER 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


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