Command reference / CL
INCLUDE
Include CL Source
Includes external text into the source program being compiled. The external text must be valid CL commands for a compiled CL source, such as declare statements (DCL or DCLF), control flow statements (IF or Select), or regular CL commands. The included text cannot cause declare commands to appear after non-declare commands.
Allowed environments: *BPGM, *IPGM.
Use within a CL program.
Positional parameters: 2.
Restrictions
- The INCLUDE command is valid only within a CL program or ILE CL procedure.
- The user needs *USE authority to the file specified for SRCFILE or SRCSTMF, and *EXECUTE authority to the library containing the source file.
- The record length of the SRCFILE source file must be the same as or less than the record length of the root CL source file. Longer included records are truncated on the right, which may cause compile-time errors or unexpected runtime behavior.
- SRCMBR and SRCFILE cannot be specified together with SRCSTMF.
Parameters
SRCMBR
Source member
Specifies the source member that contains the CL program source to be included.
SRCFILE
Source file
Specifies the source file that contains the source member to be included.
Suggested / special values:
*INCFILE
*INCFILE- The file specified for the INCLUDE file (INCFILE) parameter on the CL command used to invoke the CL compiler is used.
*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. If no current library is set, QGPL is used.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Source file
Source file
Library
Library
Suggested / special values:
*LIBL, *CURLIB
SRCSTMF
Source stream file
Specifies the path name of the stream file containing the CL source to be included. An absolute path name starts with '/'. A relative path name is resolved by prepending the searched including directory, which is the source directory first and then the directories specified in INCDIR.
Examples
INCLUDE SRCMBR(DCLSET1) SRCFILE(*INCFILE)
Includes the CL program source in member DCLSET1 at compile time. The member must be in the file specified for INCFILE on the CL command that invoked the compiler.
INCLUDE SRCSTMF('/dir/pay_data.cl')
Includes the CL program source in stream file /dir/pay_data.cl at compile time.
Generated from os/cl/catalog/INCLUDE.json and os/cl/help/INCLUDE.json.