The COBOL2000 compiler can also be controlled as usual via COMOPT statements. In this case it is invoked with the command
/START-PROGRAM [FROM-FILE =] $.COBOL2000
The input of the compilation unit, the output of listings and of the module, and the internal execution of the compilation run are controlled by means of options that the user specifies in one or more COMOPT statements. The options are read via SYSDTA after COBOL2000 is invoked.
There are three ways in which the user can enter compiler options:
The COMOPT statement(s) can be entered directly by calling the compiler without first reassigning the system file SYSDTA with the ASSIGN-SYSDTA command. In this case, the compiler explicitly requests the entry of the options by entering an asterisk (*) in column 1.
The user can write the COMOPT statement(s) into a file and issue them via the file. This file could be a compilation unit file (the options are entered before the compilation unit) or a separate file.
The file used is assigned to the system file SYSDTA with an ASSIGN-SYSDTA command before the compiler is called.COMOPT statement(s) can be entered directly, and the END statement can be used to reassign SYSDTA to a file that contains further COMOPT statements before the compilation unit.
When no further control statements are encountered, the compiler immediately begins to read the program text.
The compiler determines the location of the compilation unit via the END statement and continues reading at that point.
If invalid COMOPT or END statements are entered in a batch process, the compilation is aborted (with error message CBL9005).
Format of the COMOPT statement
{COMOPT | COBRUN} operand= {YES | NO | option | (option[,option]...)}
Input lines for COMOPT statements can be up to 128 characters in length. For ISAM files, this includes the length of the record key. The standardized reference format for writing COBOL compilation units has no significance for the input of COMOPT statements.
An operand consists of a keyword, followed by a sign of equality and one or more parameters. If several parameters can be specified in a single operand, these must be enclosed in parentheses.
If errors are detected during the processing of a COMOPT statement, all previously evaluated options from the same line remain in effect. As indicated in the error message, the rest of the operand line or the remaining part of the operand is then ignored. Error messages for operands are only output to SYSOUT. The COMOPT statements only apply to the compiler run for which they were specified.
If the same COMOPT statement is entered more than once, the last specified value applies.If conflicting COMOPT statements are entered, the statement specified last is applicable.
Format of the END statement
END {filename | libname(elementname)}
END filename or libname can be used to reassign SYSDTA to a file or a library element.
END (without any further qualification) indicates to the compiler that the input of COMOPT statements has ended and that the compilation can therefore be started.