%INCLUDE
The %INCLUDE control directive inserts, at compilation time, REXX code contained in z/OS® data sets or in CMS files into the REXX source program.
/*%INCLUDE file1 */- The directive immediately follows a
/*comment delimiter. - The directive is not part of another %INCLUDE directive or of a %COPYRIGHT directive.
- The name of the file to be included starts with the first nonblank
character following
/*%INCLUDEand must not contain any blank characters. - The z/OS data-set identifiers
memberandddnameand the CMS file identifiersfilenameandddnameare restricted to 8 characters in length.
- The word %INCLUDE can be in mixed case.
- You can only specify nested comments following the file name.
- Files that are included by means of %INCLUDE directives can contain %INCLUDE directives.
/*%INCLUDE file1 */
Say 'Hello 1'
/*%INCLUDE file2 */ Say 'Hello 2' The contents of file1 will
be inserted before Say 'Hello 1'. The last line in
the example is split into two parts, forming two lines. /*%INCLUDE file2 */Say 'Hello 2'
file2 will be inserted between
the first part and the second part, immediately following the */ delimiter.
In the compiler listing and IEXEC output, the first line is truncated.
The second part of the line is not reformatted. However, the space
previously occupied by the %INCLUDE directive
and any statements preceding it, is replaced by blanks. If the IEXEC
option has been specified, the IEXEC output will have, in this case,
variable length format (see IEXEC).
- At the end of the first part of a split line, a line end is implied.
- The built-in function SOURCELINE() returns the line number of the final line in the expanded program, or 0 if the program was compiled with the NOSLINE option.
- Under z/OS:
/*%INCLUDE member */Search for
member:- In the concatenation with ddname SYSLIB, if it is allocated
- In the same partitioned data set as the source, if the source is in a partitioned data set
/*%INCLUDE ddname(member) */Search for
memberin the concatenation withddname.
- Under z/VM®:
/*%INCLUDE filename */Search for a file with file name
filenameand file typeCOPYon all accessed disks. If it does not exist, search for a file with file namefilenameand file typeREXXINCLon all accessed disks. If it also does not exist, search for a file with file namefilenameand file typeEXECon all accessed disks.If more than one file is found for a specific file type, the one on the minidisk which comes earlier in the search order is included.
/*%INCLUDE ddname(filename) */FILEDEF ddname DISK fn ft [fm]can be used to specify a collection of files.
Note:ftmust beCOPY,REXXINCL, orEXEC, otherwise the file will not be found.Search for a file with file name
fnand file typeCOPYwithin the specified collection. If it does not exist, search for a file with file namefnand file typeREXXINCLwithin the specified collection. If it also does not exist, search for a file with file namefnand file typeEXECwithin the specified collection.If more than one file is found for a specific file type, the one on the minidisk which comes earlier in the search order is included.
-
orCREATE NAMEDEF fm ddname ( FILEMODE
followed by:CREATE NAMEDEF dirid ddname
can be used to identify a specific minidisk. Search for a file with file nameACCESS dirid fmfilename, file typeCOPY, and file modefm. If it does not exist, search for a file with file namefilename, file typeREXXINCL, and file modefm. If it also does not exist, search for a file with file namefilename, file typeEXEC, and file modefm.If a file is found for a specific file type, it is included.
- Members of MACLIBs can be included. If ddname is SYSLIB, all MACLIBs
established with the command
GLOBAL MACLIBare searched until a member with namefilenameis found and included.If ddname is not SYSLIB, search within the MACLIB with name
ddnamefor a member with namefilenameand include it.
The names of the data sets or files that have been included are contained in the compiler listing.