OPTFILE | NOOPTFILE

Category

Compiler customization

Pragma equivalent

None.

Purpose

Specifies where the compiler should look for additional compiler options.

Syntax

Read syntax diagramSkip visual syntax diagram
   .-NOOPTF-.                   
>>-+-OPTF---+--+------------+----------------------------------><
               '-(filename)-'   

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.

Example: The following specifications have the same result:
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.

If the record format of the options file is fixed and the record length is greater than 72, columns 73 to the end-of-line are treated as sequence numbers and are ignored.
Notes:
  1. 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.
  2. 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.
  3. 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.
  4. If the file cannot be opened or cannot be read, a warning message is issued and the OPTFILE option is ignored.
  5. The options file can be an empty file.
  6. Quotation marks on options (for example, '-O3') in the options file are not removed as they are when specified on the command line.
  7. Example: You can use an option file only once in a compilation. If you use the following options:
    OPTFILE(DD:OF)     OPTFILE
    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.
    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

  1. Suppose that you use the following JCL:
    //   CPARM='SO OPTFILE(PROJ1OPT) EXPORTALL'
    If the file PROJ1OPT contains OBJECT LONGNAME, the effect on the compiler is the same as if you specified the following:
    //   CPARM='SO OBJECT LONGNAME EXPORTALL'
  2. Suppose that you include the following in the JCL:
    //   CPARM='OBJECT OPTFILE(PROJ1OPT) LONGNAME OPTFILE(PROJ2OPT) LIST'
    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 SO LIST LONGNAME GONUM LIST'
  3. If an F80 format options file looks like this:
     | ...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
                                LIST                                          00000010
                                                                  INLRPT      00000020
    MARGINS                                                                   00000030
       OPT                                                                    00000040
       XREF                                                                   00000050
     
    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:
      LIST INLRPT MARGINS OPT XREF
  4. 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
    @@