The cobol command

You can use cobol.exe to compile COBOL source and generate managed code assemblies as well as native code objects.

Command Line Syntax:

To invoke the compiler prompts:
>>--cobol---><
To invoke the compiler from the command line:
>>--cobol--s-file-,-.--------.-,-.--------.-,-.--------.-.--------.-.---.-><
                    +-o-file-+   +-s-list+-   -+o-list-+ +--dirs-.+ +-;-+
                                                          ^      |
                                                          +------+ 
Where the parameters are:
s-file
The name of the file containing your source code. By default, the system looks for s-file.cbl. You can override this default by either typing an extension of your choice or using the OSEXT directive.
o-file
The name of the file to contain the compiled object code. By default, the file is named s-file.obj.

If a filename with an extension of .exe or .dll is specified, the Compiler automatically invokes the Linker once compilation is complete, to create the specified executable.

s-list
The name of the file to contain the source code listing. If the command line is terminated by a semicolon before the comma preceding this field, this option is set to NUL (indicating that no list file is produced).

If you specify s-list without an extension or trailing period, the system adds the extension .lst to create the filename s-list.lst.

o-list
The name of the file to contain the object code listing. If the command line is terminated by a semicolon before the comma preceding this field, this option is set to NUL (indicating that no list file is produced).

If you specify o-list without an extension or trailing period, the system adds the file extension .grp to create the filename o-list.grp.

dirs
A sequence of one or more Compiler directives. Directives can appear after any filename. Each directive must be separated by a space and must not be broken across two lines.
In order to compile for managed code you must include either the -ILGEN or -ILGEN(SUB) directives in this sequence.
;
Terminates the command line, causing the Compiler to use the default setting for any unspecified options. The semicolon can be entered any time after s-file.
When you invoke the Compiler without prompts:
  • You specify the parameters you require and terminate the line with a semicolon
  • The Compiler uses the default settings for any unspecified options
  • If you omit the semicolon, the Compiler prompts you for any options that you did not specify
  • Filenames specified in the command can be either a disk file or a system device