Include CL Source (INCLUDE)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
Threadsafe: Yes
Parameters
Examples
Error messages

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:

Top

Parameters

Keyword Description Choices Notes
SRCMBR Source member Name Required, Positional 1
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
Top

Source member (SRCMBR)

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

This is a required parameter.

name
Specify the name of the source member.
Top

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.
Top

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.

Example 2: INCLUDE Source From Specified File

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.

Top

Error messages

None

Top