OPTFILE | NOOPTFILE
Category
Compiler customization
Pragma equivalent
None.
Purpose
Specifies where the compiler should look for additional compiler options.
Defaults
NOOPTFILE
Parameters
- filename
- Specifies an alternative file where the compiler should look
for compiler options.
You can specify any valid filename, including a DD name such as (DD:MYOPTS). The DD name may refer to instream data in your JCL. If you do not specify filename, the compiler uses DD:SYSOPTF.
Usage
The NOOPTFILE option can optionally take a filename suboption. This filename then becomes the default. If you subsequently use the OPTFILE option without a filename suboption, the compiler uses the filename that you specified with NOOPTFILE earlier.
CXX HELLO (NOOPTF(./hello.opt) OPTF
CXX HELLO (OPTF(./hello.opt)
The options are specified in a free format with the same syntax as they would have on the command line or in JCL. The code points for the special characters \f, \v, and \t are whitespace characters. Everything that is specified in the file is taken to be part of a compiler option (except for the continuation character), and unrecognized entries are flagged. Nothing on a line is ignored.
- Comments are supported in an option file used in the OPTFILE option. When a line begins with the # character, the entire line is ignored, including any continuation character. The option files are encoded in the IBM-1047 code page.
- You cannot nest the OPTFILE option. If the OPTFILE option is also used in the file that is specified by another OPTFILE option, it is ignored.
- If you specify NOOPTFILE after a valid OPTFILE, it does not undo the effect of the previous OPTFILE. This is because the compiler has already processed the options in the options file that you specified with OPTFILE. The only reason to use NOOPTFILE is to specify an option file name that a later specification of OPTFILE can use.
- If the file cannot be opened or cannot be read, a warning message is issued and the OPTFILE option is ignored.
- The options file can be an empty file.
- Quotation marks on options (for example, '-O3') in the options file are not removed as they are when specified on the command line.
- Example: You can use an option file only once in a compilation.
If you use the following options:
the compiler processes the option OPTFILE(DD:OF), but the second option OPTFILE is not processed. A diagnostic message is produced, because the second specification of OPTFILE uses the same option file as the first.OPTFILE(DD:OF) OPTFILE
Example: You can specify OPTFILE more than once in a compilation, if you use a different options file with each specification:OPTFILE(DD:OF) OPTFILE(DD:OF1)
IPA effects
The OPTFILE option has the same effect on the IPA link step as it does on a regular compilation.
Predefined macros
None.
Examples
- Suppose that you use the following JCL:
If the file PROJ1OPT contains OBJECT LONGNAME, the effect on the compiler is the same as if you specified the following:// CPARM='SO OPTFILE(PROJ1OPT) EXPORTALL'
// CPARM='SO OBJECT LONGNAME EXPORTALL'
- Suppose that you include the following in the JCL:
If the file PROJ1OPT contains SO LIST and the file PROJ2OPT contains GONUM, the net effect to the compiler is the same as if you specified the following:// CPARM='OBJECT OPTFILE(PROJ1OPT) LONGNAME OPTFILE(PROJ2OPT) LIST'
// CPARM='OBJECT SO LIST LONGNAME GONUM LIST'
- If an F80 format options file looks like this:
The compile has the same effect as if you specified the following options on the command line or in a PARMS= statement in your JCL:| ...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 LIST 00000010 INLRPT 00000020 MARGINS 00000030 OPT 00000040 XREF 00000050
LIST INLRPT MARGINS OPT XREF
- The following example shows how to use the options file as an
instream file in JCL:
//COMP EXEC CBCC, // INFILE='<userid>.USER.CXX(LNKLST)', // OUTFILE='<userid>.USER.OBJ(LNKLST),DISP=SHR ', // CPARM='OPTFILE(DD:OPTION)' //OPTION DD DATA,DLM=@@ LIST INLRPT MARGINS OPT XREF @@