Examples Of Compiling From the Command Line

The following examples illustrate the ways in which a program, Myprog, can be compiled using a number of options from the command line.

cobol myprog,,

The Compiler creates myprog.obj but first prompts you for the listing files. If you terminate the command line with a semicolon instead of a comma:

cobol myprog; 

the Compiler creates myprog.obj but no listing files. If you enter the command line:

cobol myprog,,nul,,

the Compiler creates myprog.obj and an object code listing in myprog.grp.

Note: Entering the command line:

cobol myprog,\myobjdir\; 

causes the Compiler to create the object file myprog.obj in the myobjdir directory.

Example of Using Response File

The file myprog.rsp contains the lines:

myprog.obj
temp.lst, temp.grp
warning"3" ans85 errlist

If you compile myprog.cbl using this response file:

cobol myprog, @myprog.rsp; 

the program is compiled with the directives:

warning"3" ans85 errlist

producing myprog.obj, source listing in temp.lst, and an object listing in temp.grp.

Example of Using Compiler Prompts

The following example illustrates how you could compile a program, Myprog, using the prompts. The example assumes that Enter is pressed at the end of each line.

At the first prompt, entering the name of your source file:

Source filename [.CBL] : myprog

causes the Compiler to read from myprog.cbl. Simply pressing Enter in response to the next prompt:

Object filename [MYPROG.OBJ]:

causes the Compiler to create the file myprog.obj.

Responding to the next prompt as follows:

Source listing [NUL]:  myprog

causes the Compiler to create a file listing your source file, myprog.lst.

At the final prompt, entering:

Object listing [NUL]:  myprog

causes the Compiler to create a listing of the object code, myprog.grp.