Compiler input
None.
Specifies the directories or data sets to be searched for user include files.
When the LSEARCH compiler option is in effect, the preprocessor looks for the user include files in the specified directories or data sets.
When the NOLSEARCH compiler option is in effect, the preprocessor only searches those data sets that are specified in the USERLIB DD statement. A NOLSEARCH option cancels all previous LSEARCH specifications, and the compiler uses any LSEARCH options that follow it.
.-NOLSE---------------. | .-,----. | | V | | >>-+-LSE--(----path-+--)-+-------------------------------------><
NOLSEARCH
.-NOLSE------------------------. >>-+-LSE--+---------------------+-+---------------------------->< | .-,-----------. | | V | | '-(---+----+--opt-+-)-' '-//-'
You must use the double slashes (//) to specify data set library searches when you specify the OE compiler option. (You may use them regardless of the OE option).
The USERLIB ddname is considered the last suboption for LSEARCH, so that specifying LSEARCH (X) is equivalent to specifying LSEARCH (X,DD:USERLIB).
Parts of the #include filename are appended to each LSEARCH opt to search for the include file. opt has the format:
.-,---------. V | >>-+-+---+----qualifier-+--+-----+--+---+-+-------------------->< | '-'-' +-.+␠-+ '-'-' | | '-.*␠-' | +-+---+--+- + -+--+---+----------------+ | '-'-' '- * -' '-'-' | | .-,-------------. | | V | | +---+-directory-+-+--------------------+ | +-./--------+ | | +-../-------+ | | '-/---------' | +-DD:name------------------------------+ | .-,------. | | V | | '-(fname.suffix)=LIB(----subopt-+--)---'
LSEARCH(DD:NEWLIB)
#include "a.b(c)"
The resulting file name is DD:NEWLIB(C).There is no effect on the search path if no pds is specified, but a warning is issued.
When the #include filename matches the pattern of fname.suffix, the search continues according to the subopts in the order specified. An asterisk (*) in fname or suffix matches anything. If the compiler does not find the file, it attempts other searches according to the remaining options in LSEARCH.
When you specify more than one LSEARCH option, the compiler uses all the directories or data sets in these LSEARCH options to find the user include files.
The #include "filename" format of the #include C/C++ preprocessor directive indicates user include files. See Using include files for a description of the #include preprocessor directive.
For further information on search sequences, see Search sequences for include files.
When specifying z/OS UNIX library searches, do not put double slashes at the beginning of the LSEARCH opt . Use pathnames separated by slashes (/) in the LSEARCH opt for a z/OS UNIX library. When the LSEARCH opt does not start with double slashes, any single slash in the name indicates a z/OS UNIX library. If you do not have path separators (/), then setting the OE compile option on indicates that this is a z/OS UNIX library; otherwise the library is interpreted as a data set. See Using SEARCH and LSEARCH for additional information on z/OS UNIX files.
LSEARCH(/u/mike/myfiles)
#include "new/headers.h"
The resulting z/OS UNIX file
name is /u/mike/myfiles/new/headers.h.Use an asterisk (*) or a plus sign (+) in the LSEARCH opt to specify whether the library is a sequential or partitioned data set.
When you want to specify a set of PDSs as the search path, you add a period followed by a plus sign (.+) at the end of the last qualifier in the opt. If you do not have any qualifier, specify a single plus sign (+) as the opt. The opt has the following syntax for specifying partitioned data set:
>>-+---+--+- + --------------------+--+---+-------------------->< '-'-' | .-,---------. | '-'-' | V | | '---qualifier-+--+-----+-' '-.+␠-'
where qualifier is a data set qualifier.
Start and end the opt with single quotation marks (') to indicate that this is an absolute data set specification. Single quotation marks around a single plus sign (+) indicate that the filename that is specified in #include is an absolute partitioned data set.
When you do not specify a member name with the #include directive, for example, #include "PR1.MIKE.H", the PDS name for the search is formed by replacing the plus sign with the following parts of the filename of the #include directive:
See the first example in Table 1.
However, if you specified a member name in the filename of the #include directive, for example, #include "PR1.MIKE.H(M1)", the PDS name for the search is formed by replacing the plus sign with the qualified name of the PDS. See the second example in Table 1.
See Forming data set names with LSEARCH | SEARCH options for more information on forming PDS names.
LSEARCH(AAAA.BBBB)
#include "sys/ff.gg.hh"
Resulting PDS name is
userid.AAAA.BBBB(FF)
Also see the third example in
Table 1.None.
#include "sub/fred.h"
#include "fred.inl"
LSEARCH(USER.+,'USERID.GENERAL.+')
The compiler uses the following search sequence to look for your include files:
USERID.USER.SUB.H(FRED)
USERID.GENERAL.SUB.H(FRED)
USERID.USER.INL(FRED)
USERID.GENERAL.INL(FRED)
The compiler forms the search path for z/OS UNIX files by appending the path and name of the #include file to the path that you specified in the LSEARCH option.
LSEARCH(/u/mike)
The
compiler looks for the include file /u/mike/sub/fred.h .LSEARCH(/u/mike, ./sub)
The compiler uses the following search sequence to look for your include files:
include Directive | LSEARCH option | Result |
---|---|---|
#include "PR1.MIKE.H" | LSEARCH('CC.+') | 'CC.MIKE.H(PR1)' |
#include "PR.KE.H(M1)" | LSEARCH('CC.+') | 'CC.PR.KE.H(M1)' |
#include "A.B" | LSEARCH(CC) | userid.CC(A) |
#include "A.B.D" | LSEARCH(CC.+) | userid.CC.B.D(A) |
#include "a/b/dd.h" | LSEARCH('CC.+') | 'CC.A.B.H(DD)' |
#include "a/dd.ee.h" | LSEARCH('CC.+') | 'CC.A.EE.H(DD)' |
#include "a/b/dd.h" | LSEARCH('+') | 'A.B.H(DD)' |
#include "a/b/dd.h" | LSEARCH(+) | userid.A.B.H(DD) |
#include "A.B(C)" | LSEARCH('D.+') | 'D.A.B(C)' |
When you want to specify a set of sequential data sets as the search path, you add a period followed by an asterisk (.*) at the end of the last qualifier in the opt. If you do not have any qualifiers, specify one asterisk (*) as the opt. The opt has the following syntax for specifying a sequential data set:
>>-+----+--+---+--+- * --------------------+--+---+------------>< '-//-' '-'-' | .-,---------. | '-'-' | V | | '---qualifier-+--+-----+-' '-. *-'
where qualifier is a data set qualifier.
Start and end the opt with single quotation marks (') to indicate that this is an absolute data set specification. Single quotation marks (') around a single asterisk (*) means that the file name that is specified in #include is an absolute sequential data set.
The asterisk is replaced by all of the qualifiers and periods in the #include filename to form the complete name for the search (as shown in the following table).
include Directive | LSEARCH option | Result |
---|---|---|
#include "A.B" | LSEARCH(CC.*) | userid.CC.A.B |
#include "a/b/dd.h" | LSEARCH('CC.*') | 'CC.DD.H' |
#include "a/b/dd.h" | LSEARCH('*') | 'DD.H' |
#include "a/b/dd.h" | LSEARCH(*) | userid.DD.H |
#include "A.B"
LSEARCH('CC')
Result is 'CC(A)' which
is a PDS.