

1.0  cob2 - COBOL Compiler and Linker Invocation, Version 2.2


   Usage:
        cob2 options | filenames

   The command cob2 invokes the COBOL compiler and linker.  cob2 accepts
   options to control the compilation and link-edit in any order on the
   command line.  Likewise, if you want to compile multiple files, the
   filenames can be specified at any position in the command syntax.
   However, all options and filenames should be separated by spaces.

   Because OS/2 and Windows are not case-sensitive, cob2 and its options
   do not need to be capitalized.


1.1.1  cob2 Options:
--------------------

   Options can be one or more of the following:

   -b"xxx"       Pass the xxx string to the linker as parameters.  xxx
                 is a list of linker options separated by blank spaces.
                 The cob2 default parameters are also passed.  There
                 should be no spaces between -b and "xxx"

   -c            Compile programs, but do not link them.

   -cmain        Make a C or PL/I object file containing a main routine
                 the main entry point in the executable file (.EXE).

                 Warning: If a C or PL/I object file containing a main
                 routine is linked with one or more COBOL object files,
                 -cmain _must_ be used to designate the C or PL/I
                 routine as the main entry point in the executable file;
                 a COBOL program _cannot_ be the main entry point in an
                 executable file containing a C or PL/I main.
                 Unpredictable execution behavior will occur if this is
                 attempted and no diagnostics are issued.

                 (OS/2>>)

                 Under OS/2, -cmain is only required if -host is also
                 specified.

                 (<<)

                 Example:
                     cob2 -cmain myCmain.obj myCOBOL.obj
                 and
                     cob2 -cmain myCOBOL.obj myCmain.obj -main:myCmain
                 both generate the executable file myCmain.exe with the
                 main entry point being the C main() function contained
                 in the myCmain.obj object file.

   -comprc_ok=n  Controls the cob2 behavior on the return code from the
                 compiler.  If the return code is less than or equal to
                 n, cob2 continues to the link step or, in the compile
                 only case, exits with a zero return code.  If the
                 return code generated by the compiler is greater than
                 n, cob2 exits with the same return code returned by the
                 compiler.

                 The default is: -comprc_ok=4.

   -dll | -dll:xxx
                 Causes cob2 to produce linker files (.LIB and .EXP) to
                 create a DLL named xxx.  If xxx is omitted, the name of
                 the first object (.OBJ) or COBOL source (usually .CBL
                 or .PPR) file specified in the cob2 command is the name
                 of the DLL (and .LIB and .EXP files).

   -g            Produce symbolic information used by the debugger.

   -host         Set all host data compiler options: BINARY(S390),
                 CHAR(EBCDIC), COLLSEQ(EBCDIC), and FLOAT(S390).

   -Ixxx         Add a path xxx to the directories to be searched for
                 COPY files if a library-name compiler environment
                 variable is not specified.  Only a single path is
                 allowed per -I option.  To add multiple paths, use
                 multiple -I options.  There should be no spaces between
                 -I and xxx.  (This is upper-case "eye," not lower-case
                 "el.")

                 Use LIB: If you use the COPY statement, you must ensure
                 that the LIB compiler option is in effect.

                 For a description of the manner in which the compiler
                 evaluates paths for COPY files, see the VisualAge COBOL
                 Programming Guide.

   -main:xxx     Make object file xxx the COBOL main program of the
                 executable (.EXE) file.  xxx must be the filename of an
                 object (.OBJ) file or source file specified to cob2.
                     cob2 -main:abc a1.cbl d:\cats\abc.obj b2.cbl
                 will result in abc being the main program.  xxx cannot
                 appear in a linker response file.

                 If -main is not specified, the first object or source
                 file specified will, in the absence of a response file,
                 be the COBOL main program.

                 If the syntax of -main:xxx is invalid, or xxx is not
                 the filename of an object or source file processed by
                 cob2, cob2 will terminate.

   -p            Include the profile hooks that allow the Performance
                 Analyzer to monitor the application execution and
                 create a trace file.

   -qxxx         Use the option xxx (where xxx is any compiler option)
                 when calling the compiler.  If a parenthesis is part of
                 the compiler (sub)option, or a series of options are
                 specified, they should be included in quotes.  For
                 multiple options, each option should be delimited by a
                 blank or comma.  There should be no spaces between -q
                 and xxx.  For example, you can use
                     -qoptiona,optionb
                 or
                     -q"optiona optionb"

   -v            Display compile and link steps, and execute them.

   -#            Display compile and link steps, but do not execute
                 them.



1.1.2  cob2 Examples:
---------------------

   The following examples illustrate the use of cob2:

   o   To compile the file alpha.cbl, enter:
           cob2 -c alpha.cbl
       The compiler produces the files alpha.obj and alpha.lst.

   o   To compile alpha.cbl and beta.cbl, enter:
           cob2 -c alpha.cbl c:\mydir\beta.cbl
       The compiler produces the files alpha.obj, beta.obj, alpha.lst,
       and beta.lst in the current directory.

   o   To link two files together, compile them without the -c option.
       For example, to compile and link alpha.cbl and beta.cbl and
       generate alpha.exe, enter:
           cob2 alpha.cbl beta.cbl
       This command creates alpha.obj and beta.obj, then links
       alpha.obj, beta.obj, and the COBOL libraries.  If the link step
       is successful, it produces an executable program named alpha.exe.

   o   In the following example:
           cob2 alpha.obj beta.cbl mylib.lib gamma.exe
       beta.cbl is compiled, and the string:
           alpha.obj beta.obj mylib.lib /out:gamma.exe
       is passed to the linker.  If linking is successful, the
       executable gamma.exe is produced.

   o   In the following example:
           cob2 alpha.cbl alpha.def
       alpha.dll will be produced (assuming a valid alpha.def file).

   o   To compile with the LIST and NOADATA options, enter:
           cob2 -qlist,noadata alpha.cbl
       Note that there is no space between the "-q" and the options
       list.  Options should be delimited by commas or blanks if
       enclosed in quotes:
           cob2 -q"list noadata" alpha.cbl



1.1.3  Usage Notes for cob2:
----------------------------

   1.  Any options specified apply to all files on the command line.
   2.  cob2 passes all files with extensions def, dll, exp, exe, lib,
       map, and obj to the linker; all other files are passed to the
       compiler.
   3.  The default location for compiler input and output is the current
       directory.



1.1.4  COBOL Compiler Options Summary:
--------------------------------------

   You can specify compiler options at the command line using the -q
   option of cob2.  Select from the following COBOL compiler options:

   ADATA | NOADATA
       Use ADATA to create a SYSADATA file.
   ANALYZE | NOANALYZE
       Use ANALYZE to check syntax of embedded SQL and CICS statements.
   BINARY(NATIVE | S370 | S390)
       Determines how binary data is represented.
   CALLINT(SYSTEM | OPTLINK | FAR16 | PASCAL16 | CDECL)
       Indicate the call interface convention for CALLs.
   CHAR(NATIVE | EBCDIC | S390)
       Determines how character data is represented.
   COLLSEQ(NATIVE | EBCDIC | BIN)
       Determines which collating sequence is used.
   COMPILE | NOCOMPILE(W | E | S)
       Determines conditional compilation in regard to errors.
   CURRENCY(literal) | NOCURRENCY
       Use to replace the currency symbol ($).
   DATEPROC(FLAG | NOFLAG) | NODATEPROC
       Enables date processing with century window recognition.
   DYNAM | NODYNAM
       Use DYNAM to have CALL 'literal' statements resolved at run time.
   ENTRYINT(SYSTEM | OPTLINK | CDECL)
       Indicate the call interface for USING phrase of PROCEDURE
       DIVISION or ENTRY statement.
   EVENTS | NOEVENTS
       Use EVENTS to create a SYSADATA file.  (Compatibility with
       COBOL/370 Release 1.)
   EXIT(INEXIT | LIBEXIT | PRTEXIT | ADEXIT) | NOEXIT
       Use EXIT to allow compiler to accept user-defined exit modules.
   FLAG | NOFLAG
       Use FLAG to produce diagnostic messages conditional on a given
       severity level.
   FLAGSTD | NOFLAGSTD
       Flags various language elements.
   FLOAT(NATIVE | HEX | S390)
       Determines how floating point data is represented.
   IDLGEN | NOIDLGEN
       Indicates whether Interface Definition Language should be
       generated for COBOL class definitions.
   LIB | NOLIB
       If your program uses COPY, BASIS, or REPLACE statements, the LIB
       option must be in effect (default).
   LINECOUNT(nnn)
       Specify the number of lines to be printed on each page of the
       compilation listing.
   LIST | NOLIST
       Use LIST to produce a listing of the assembler-language expansion
       of your source code.
   MAP | NOMAP
       Use MAP to produce a listing of the items you defined in the DATA
       DIVISION.
   NUMBER | NONUMBER
       Use NUMBER if you want to relate source code line numbers to
       error messages, MAP, LIST, or XREF listings.
   OPTIMIZE(STD | FULL) | NOOPTIMIZE
       Use OPTIMIZE to reduce the run time of your application.
   PGMNAME(MIXED | UPPER)
       Determines how character-case will be handled.
   PROBE | NOPROBE
       Requests the generation of stack probes.
   PROFILE | NOPROFILE
       Use PROFILE to generate profile hooks for use by the Performance
       Analyzer.
   QUOTE/APOST
       Specify delimiter character for literals.
   SEPOBJ | NOSEPOBJ
       Specifies whether outermost COBOL programs in a batch compilation
       are generated as separate object files or a single object file.
   SEQUENCE | NOSEQUENCE
       Use SEQUENCE to instruct the compiler to check the order of
       statements by ASCII collating sequence.
   SIZE(nnnnnn)
       Use SIZE to indicate the amount of main storage available for
       compilation.
   SOURCE | NOSOURCE
       Use SOURCE to get a listing of your source program.
   SPACE(1 | 2 | 3)
       Determine spacing in your source code listing.
   SQL("suboptions for DB2 SQL") | NOSQL
       Use SQL when you have SQL statements embedded in your COBOL
       source.
   SSRANGE | NOSSRANGE
       Use SSRANGE to generate code that checks if subscript or index
       references are out of range.
   TERMINAL | NOTERMINAL
       Use TERMINAL to send progress and diagnostic messages to the
       terminal.
   TEST | NOTEST
       Use TEST to generate code that will work with the debugger.
   THREAD | NOTHREAD
       Use THREAD to generate a multi-threaded program.
   TRUNC(STD | OPT | BIN)
       Determines how arithmetic fields are truncated.
   TYPECHK | NOTYPECHK
       Use TYPECHK to have the compiler enforce the rules for
       object-oriented type checking.
   VBREF | NOVBREF
       Use VBREF to get a cross-reference listing of verb types and
       source program line numbers.
   WSCLEAR | NOWSCLEAR
       Use WSCLEAR to clear working-storage to binary zeros.
   WORD(xxx) | NOWORD
       Use WORD to specify an alternate COBOL reserved word table.
   XREF(SHORT | FULL) | NOXREF
       Use XREF to get a sorted cross-reference listing.
   YEARWINDOW(nnnn | -nn)
       Specifies the century window for date recognition.
   ZWB | NOZWB
       Use ZWB to instruct the run-time to remove the sign from a signed
       external decimal (DISPLAY) field when comparing this field to an
       alphanumeric elementary field during execution.

   *** For a detailed description of compiler options, please refer to
   the Programmer's Guide.


1.1.5  Running COBOL Programs:
------------------------------

   To run a COBOL program, first make sure that any needed environment
   variables are set.  Then type the name of the executable module on
   the command line or execute a command file which invokes the module.
   For example, if
       cob2 alpha.cbl beta.cbl
   is successful, you can execute the program by typing:
       alpha

