Chapter Contents

Previous

Next
SEARCH

SEARCH



Creates or manipulates the current catalog search path

Category: Catalog


Syntax
Details
Example
See Also

Syntax

rc=SEARCH(cat-name|special-argument);

rc
contains the return code for the operation:
0 successful
-1 not successful

Type: Numeric

cat-name
is the catalog to push to the front of the current search list.

Type: Character

special-argument
are any of the following:

'-DISABLE'
to disable the current search list.

'-ENABLE'
to enable the current search list. If there is no disabled list, then the current search list remains empty.

'-POP'
to remove the first name from the current search list.

'-POPALL'
to clear the current search list.

Note:   You must include the hyphen (-) as the first character in each of these argument values. Otherwise, the value will be treated as a catalog name in the WORK library.  [cautionend]

Type: Character


Details

You do not need to know the exact location of a catalog member, only that it is in one of the catalogs in the current search path.

When a function that uses the current search path is called, the catalogs in the search path are searched from first to last until the specified entry is found or until the end of the search path is reached.

If there is no current search path, or if the current search path has been disabled or overridden, then the search is limited to the current catalog.


Example

Set up a search list with MYLIB1.CAT1, MYLIB1.CAT2 and MYLIB1.CAT3. Each time SEARCH is called, the new value of the argument is pushed to the front of the list. Therefore, MYLIB1.CAT3 is searched first. If MYPROG.PROGRAM exists only in MYLIB1.CAT1, it still executes correctly, because MYLIB1.CAT1 is also in the search path.

rc=search('mylib1.cat1');
rc=search('mylib1.cat2');
rc=search('mylib1.cat3');
call display('myprog.program');

See Also

CEXIST

DISPLAY

SEARCHPATH


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.