SEARCH function
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
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
|
- 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 Internationalize ABL 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
|
Notes
- The
SEARCHfunction is double-byte enabled. You can specify a filename with the opsys-file argument that contains double-byte characters. - Use the
SEARCHfunction to ensure that procedures that get input from external data files are independent of specific directory paths. The files must be in one of the directories or libraries defined in the PROPATH environment variable. - Typically, the PROPATH includes a nil entry representing the current
working directory. If the
SEARCHfunction finds the file when searching this entry, it returns only the simple name of the file rather than the full pathname. If the PROPATH does not include a nil entry or another entry that specifies the current working directory, theSEARCHfunction does not search the current working directory. - If you provide a fully qualified pathname,
SEARCHchecks if the file exists. In this case,SEARCHdoes not search directories on the PROPATH. - When you search for a file that is in a library,
SEARCHreturns the file's pathname in the form path-name<<member-name>>, where path-name is the pathname of the library and member-name is the name of the file. The double angle brackets indicate that the file is a member of a library. For example, in the path /usr/apps.pl<<proc1.r>>, proc1.r is the name of the file in the library apps.pl.The
LIBRARYfunction andMEMBERfunction use the special syntax to return, respectively, the library name and member-name of the file in the library. - If an application repeatedly runs a procedure, you can improve
performance by using the
SEARCHfunction once to build a full pathname for that procedure. Use this value in theRUNstatement to avoid repeated searches of the PROPATH. - In Windows, you can specify URL pathnames on the PROPATH. If the file is
found in a directory specified by a URL,
SEARCHreturns the full URL pathname of the file which includes the filename appended to the URL PROPATH entry. If you provide a fully-qualified URL,SEARCHchecks if the file exists. In this case,SEARCHdoes not search URLs on the PROPATH. Valid URL protocols include HTTP and HTTPS.Note: URL pathnames cannot contain the percent symbol (%). If an error exists in a URL specified on the PROPATH, theSEARCHfunction continues searching with the next PROPATH entry. - If you specify URL pathnames on the PROPATH and your application
repeatedly uses the
LOAD-ICON( ), LOAD-SMALL-ICON( ), LOAD-IMAGE( ), LOAD-IMAGE-DOWN( ), LOAD-IMAGE-UP( ), LOAD-IMAGE-INSENSITIVE( ), or LOAD-MOUSE-POINTER( )methods with a URL pathname, you can improve performance by using theSEARCHfunction once to determine the full URL pathname to the directory containing the image files. Use this value with the load methods to avoid repeated searches of the PROPATH.