Include CL Source (INCLUDE)

The Include CL Source (INCLUDE) command includes external text into the source program being compiled. The external text must be valid CL commands that are valid in a compiled CL source. These commands can be declare statements (like DCL or DCLF), control flow statements (like IF or Select), or regular CL commands (like CRTLIB or RMVM). However, the included text cannot cause declare commands to appear after non-declare commands.

Restrictions:

Parameters

Keyword Description Choices Notes
SRCMBR Source member Name Start of changeOptional, Positional 1End of change
Start of changeSRCSTMFend of change Source stream file Path name Optional
SRCFILE Source file Single values: *INCFILE
Other values: Qualified object name
Optional, Positional 2
Qualifier 1: Source file Name
Qualifier 2: Library Name, *LIBL, *CURLIB

Source member (SRCMBR)

Specifies the source member that contains the CL program source to be included.

name
Specify the name of the source member.
Start of change

Source stream file (SRCSTMF)

Specifies the path name of the stream file containing the CL source to be included.

The path name can be either absolutely or relatively qualified. An absolute path name starts with '/'; a relative path name starts with a character other than '/'.

If absolutely-qualified, the path name is complete.

If relatively-qualified, the path name is completed by pre-appending the searched including directory to the path name. The including directories to be searched are specified by the INCDIR parameter. The including source file will be searched by the following order:

  1. The source directory.
  2. The directories specified in the INCDIR parameter.
End of change

Source file (SRCFILE)

Specifies the source file that contains the source member to be included.

Single Values

*INCFILE
The file specified for the INCLUDE file (INCFILE) parameter on the CL command used to invoke the CL compiler is used.

Qualifier 1: Source file

name
Specify the name of the source file.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the thread is used to locate the source file. If no library is specified as the current library for the thread, the QGPL library is used.
name
Specify the name of the library to be searched.

Examples

Example 1: Include CL Source Using Default INCLUDE File

INCLUDE   SRCMBR(DCLSET1)  SRCFILE(*INCFILE)

This command will cause the CL program source in member DCLSET1 to be included at compile time. Member DCLSET1 must be located in the file specified for the INCFILE parameter on the CL command which invoked the CL compiler.

Start of change

Example 2: Include CL Source From Specified FileEnd of change

INCLUDE   SRCMBR(SUBR1)  SRCFILE(MYLIB/COMMONSUBR)

This command will cause the CL program source in member SUBR1 to be included at compile time. Member SUBR1 must be located in file COMMONSUBR in library MYLIB.

Example 3: Include CL Source From Specified Stream File

INCLUDE   SRCSTMF('/dir/pay_data.cl')

This command will cause the CL program source in stream file '/dir/pay_data.cl' to be included at compile time.

Error messages

None