Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cobol(1) — COBOL 2.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as(1)

cc(1)

decladebug(1)

ld(1)

pixie(1)

prof(1)

what(1)

cobol(1)  —  Commands

NAME

cobol − invokes the Compaq COBOL compiler

SYNOPSIS

cobol [ flags ] filename [ flags ]

DESCRIPTION

The cobol command invokes the Compaq COBOL (COBOL) compiler. It produces object code files in Tru64 UNIX extended coff format. 

The cobol command interprets arguments (filenames) as follows:

•Arguments with the suffix .cob, .COB, .cbl, or .CBL are interpreted as COBOL source programs.  These programs are compiled, and the name of the resulting object program is the basename of the source file with .o substituted for the .cob, .COB, .cbl, or .CBL.  (For example, in source file myfile.cob, myfile is the basename; therefore, the object program is named myfile.o.)  If the source program is compiled and loaded, the .o file is deleted. 

If the environment variable TMPDIR is set, the value is used as the directory for temporary files. 

Upon completion, the cobol driver returns one of the following status values:

   0  -  SUCCESS
   1  -  FAILURE
   2  -  SUBPROCESS_FAILURE (cobol or cc)
   3  -  SIGNAL

For more information on this version of the Compaq COBOL compiler, see the release notes in /usr/lib/cmplrs/cobol/relnotes. 

FLAGS

The cobol command takes the following flags:

-align Specifies the alignment of binary data items within record structures.  Specifying results in Alpha data alignment, to increase performance and conformity to the Alpha Calling Standard.  The flag specifies natural alignment; it aligns all COMP, COMP-1, COMP-2, INDEX, and POINTER data along natural boundaries.  A natural boundary is the smallest boundary at which data can be aligned without crossing the next boundary for that type.  For example, longword is the natural boundary for four-byte integers.  Specifying is equivalent  to using the SYNCHRONIZED clause.  (Refer to the Compaq COBOL Reference Manual for  information about the SYNCHRONIZED clause.)  Specifying indicates Alpha natural alignment and padding of records according to the Alpha Calling Standard. 

By default, the flag is turned off, and data is aligned on byte boundaries for compatibility with Compaq VAX COBOL and other OpenVMS VAX languages. 

-ansi Indicates that the source program is in conventional ANSI format. The compiler then expects 80-character card image records with optional sequence numbers in character  positions 1 through 6, indicators in position 7, Area A beginning in position 8, Area B beginning in position 12, and the identification area in positions 73 through 80. 

By default, the flag is turned off, and the source program is in terminal format, where Area A begins in position 1, Area B begins in position 5, and the source program records do not have line numbers. 

−C Equivalent to the −check bounds flag. Generates code to perform run-time checks on subscript and substring expressions.  An error is reported if the expression is outside the dimension of the array or the length of the string.  By default, range checking is suppressed. 

−c Suppresses the loading phase of the compilation and forces production of an object file even if only one program is compiled. 

−call_shared
Produces a dynamic executable that uses shareable objects during run time. The linker searches for unresolved references in shared library (.so) files before searching in archive library (.a) files. The run-time loader is invoked to bring in all required shareable objects and resolve any symbols that remained undefined during static link time. This is the default.

-check all Specifies conditions to be checked at execution time.  Causes the system to check the validity of numeric digits, PERFORM statements, indexes, subscripts, reference  modification, and the OCCURS DEPENDING ON depending item for  specific run-time errors.  By default, checking is suppressed.  If you specify a option (other than all or none) checking is limited to that option, and the default options do not change unless they are individually modified. 

-check [no]bounds
Verifies the range of  subscripts  and  reference modifiers.  The flag is equivalent to -C. The default is nobounds.  Specifying causes the system to check the range  of subscripts, indexes, and the depending item in the DEPENDING ON phrase of the OCCURS clause. The system generates a run-time message and aborts the program if it detects one of these errors: (1) if DEPENDING ON is not specified and a subscript or index is greater than the upper bound or less than or equal to zero; or (2) if DEPENDING ON is specified and a subscript or index is greater than the depending item or less than or equal to zero; or (3) if a depending item is less than the low bound or greater than the upper bound, and either a subscripted or indexed item references a table, or a group containing the table is referenced as a sending item.

-check [no]decimal
Validates numeric characters when numeric display items are used in a numeric context, and generates an error if any digit is invalid (not  numeric).  The default is nodecimal.

Specify to detect logic errors in  programs that result in text data being moved to numeric data items.  You can also use this flag to validate data produced by other systems that may use a different internal representation for numeric data. 

Specifying produces extra instructions to perform these checks, which may result in slightly larger images and slightly longer execution times. 

-check [no]perform
Verifies that PERFORM statement rules are  met. The default is noperform.  Specifying causes the system to check PERFORM statements.  Incorrect use of PERFORM statements can produce  unpredictable results and, when used with the perform option, causes the system to generate a run-time message and abort the program.

-check none Suppresses all checking.  This is the default. 

-conditionals [selector]
Controls whether the conditional compilation lines in a source program are compiled or treated as comments.  Specifying with no selector results in all conditional compilation lines being compiled. Specifying  -conditionals selector, where a selector is a list of one or more characters from A to Z, results in the selected conditional compilation lines being compiled. 

By default, the flag is turned off. 

-convert [no]leading_blanks
Instructs the compiler to change all blanks to zeros in numeric display items.  The default is

-copy Controls whether source statements included by COPY statements are printed in the listing file (if one is generated with or By default, they are not printed in the listing file. 

-copy_list Equivalent to

−cord Runs the cord() procedure-rearranger on the resulting file after linking.  This rearrangement reduces the cache conflicts of the program’s text.  The output of cord() is left in the file specified by the −o output flag (or a.out, by default).  At least one file must be specified. 

−cross_reference
Includes in the listing (if one is generated with or a cross-reference of all symbols used in the source program, with user-defined names arranged alphabetically, along with line numbers of definitions and uses.  Equivalent to the −show xref flag.  The flag has no effect unless you also specify the or flag.  By default, the cross-reference listing is suppressed. 

In the listing file, the pound sign (#) indicates the source line containing the definition of the user-defined name, while the asterisk (∗) indicates a line on which the associated data item  is modified. 

-cross_reference alphabetical
Equivalent to

-cross_reference declared
Produces a listing of user-defined names in order of declaration.

−D num Tells ld() to set the data segment origin.  If num starts with a hexadecimal letter, precede it with the digit "0". 

−feedback file
Specifies the file to be used as a feedback file (used with the the or the flag).  This file is produced by prof() with its flag from an execution of the program produced by pixie(.).

-fips 74 Supports the Federal Information Processing Standards Publication 21-1 (FIPS-PUB 21-1), issued by the National Institute for Standards and Technology (NIST), interpretation of file status.   FIPS-PUB 21-1 specifies that a file status of 10 be returned for at end conditions. If you do not specify several at end file status values will not be 10.  For version-to-version COBOL compatibility, do not use This flag applies only if you also specify

-flagger [option]
Allows you to specify a  FIPS level of COBOL syntax, in accordance with the Federal Information Processing Standards Publication 21-3 (FIPS-PUB 21-3) issued by the National Institute for Standards and Technology (NIST), beyond which the compiler generates informational messages.   The flagger options are high_fips, intermediate_fips, minimum_fips, obsolete, optional_fips,  report_writer, segmentation, and segmentation_1.

The high_fips option flags language constructs that are above the FIPS high validation level, such as Compaq extensions to ANSI COBOL. 

The intermediate_fips option flags language constructs that are above the FIPS intermediate validation level, such as language constructs that are within the FIPS high validation level or Compaq extensions to ANSI COBOL. 

The minimum_fips option flags language constructs that are above the FIPS minimum validation level, such as language constructs that are within  the FIPS high and intermediate validation levels or Compaq extensions to ANSI COBOL. 

The obsolete option flags language constructs that the ANSI 1985 COBOL Standard identifies as obsolete. If a language construct is within the  selected FIPS validation level or optional module and is also on the obsolete list, the compiler generates only the obsolete  informational message. 

The optional_fips option flags language constructs that are within FIPS optional modules, including Report  Writer and Segmentation. 

The report_writer option (a subset of OPTIONAL_FIPS) flags language constructs that are within the FIPS optional module Report Writer. 

The segmentation option (a subset of OPTIONAL_FIPS) flags language constructs that are within the FIPS optional module Segmentation. 

The segmentation_1 option (a subset of OPTIONAL_FIPS) flags language constructs that are above the level 1 of the FIPS optional module Segmentation. 

If you use the flag without specifying a FIPS level, the compiler assumes

You cannot specify the flag with the flag. 

By default, is turned off. 

For additional information about the required and optional modules for the COBOL language, refer to the American National Standard Programming Language - COBOL, ANSI X3.23-1895, ISO 1989-1985.  For more information about the FIPS validation levels, see Federal Information Processing Standards Publication 21-3. 

−g0 Prevents symbolic debugging information from appearing in the object file. 

−g1 Produces traceback information (showing pc to line correlation) in the object file, substantially increasing its size.  This is the default. 

−g2 or −g Produces traceback and symbolic debugging information in the object file.  This flag sets the −O0 flag.  However, if you specify an explicit −O option, the specified option is effective. 

−g3 Produces traceback and symbolic debugging information in the object file, and performs whatever optimizations you specify.   This flag can produce additional debugging information  describing the effects of optimizations, but debugging  inaccuracies can occur as a result of the optimizations that have been performed. 

−granularity byte
Generates additional code to preserve surrounding data within a longword or a quadword being udpated.

−granularity long
Generates additional code to preserve surrounding data within a quadword being udpated.

−granularity quad
This is the default granularity used by the compiler.  No additional code is generated to preserve data within a naturally aligned quadword (8 bytes) being udpated.  Multiple processes sharing data may experience lost updates if they both try to update different bytes within the same quadword concurrently.

−include dir Specifies additional search path criteria for locating COPY files whose names do not include a directory path.  The search path used is current working directory first, followed by the argument specified with each flag.  may be an environment variable. 

−K Does not remove temporary files created during compilation and linking. This flag does not affect the naming of temporary files.  To see the names and locations of the temporary files, specify −v. 

−L Prevents the linker from searching for libraries in the standard directories. 

−Ldir Directs the linker to search for libraries in dir before searching the standard directories. 

-list Equivalent to

−lstring Searches string libraries for ld. This flag should be placed at the end of the command line.

-mach Equivalent to and

−machine_code
Includes in the listing (if one is generated with or ), a machine language representation of the compiled code. This machine language cannot be assembled.  By default, −machine_code is turned off. 

-map Causes the compiler to produce the following maps in the listing file:  data names, procedure names, file names, and their attributes; and external references such as user-called routines or Run-Time Library routines.  The list of map items is arranged alphabetically. 

The flag has no effect unless you also specify the or flag.  By default, the creation of maps in the listing file is suppressed. 

-map alphabetical
Equivalent to

-map declared
Produces a list of map items in the order in which they were declared.

-math_intermediate cit3
Specifies that Cobol Intermediate Temporary (design 3) be used as the intermediate data type when the result of an arithmetic operation can not be represented exactly.  Intermediate values are truncated to the most significant 18 decimal digits.

-math_intermediate cit4
Specifies that Cobol Intermediate Temporary (design 4) be used as the intermediate data type when the result of an arithmetic operation can not be represented exactly.  Intermediate values are truncated to the most significant 32 decimal digits.

-math_intermediate float
Specifies that double-precision floating-point be used as the intermediate data type when the result of an arithmetic operation can not be represented exactly.  Intermediate values are truncated to the most significant 53 bits, providing approximately 15 decimal digits of precision.  This is the default.

−names as_is
Causes Compaq COBOL not to  change  the case of literal entry- names for CALL statements.  The as_is option has no affect on other external datanames or program-id names.  Compaq COBOL does not support mixed-case of external data names or program-id names. However, may be useful for calling  non-Cobol programs. When as-is is specified, external datanames are treated as if had  been specified and program-id names are treated as if had  been specified.

−names lower
Causes Compaq COBOL to force  all external names (program-id’s, literal entrynames in CALL statements, external  data  items) to be lowercase.  This is the default.

−names lowercase
Equivalent to

−names upper
Causes Compaq COBOL to  force all external names (program-id’s, literal entrynames in CALL statements, external  data items) to be uppercase.  The default is

−names uppercase
Equivalent to

−nationality us
The default currency sign and symbol are the Dollar sign, and Japanese language support features are disabled.

−nationality japan
The default currency sign and symbol are the Yen sign, and Japanese language support features are enabled including national character user-defined-words, data items (PIC N), and literals (N"").

−nolocking Turns off default file locking.  Must be used when you compile programs that access files served from NFS or UCX file systems. 

−non_shared
Does not produce a dynamic executable.  The linker will search regular archive library (.a) files to resolve undefined references; .so files are not searched.   Object files (.o suffix) from archives are included in the executable produced. The default is −call_shared. 

−noobject Prevents the production of an object file.  By default, the compiler produces an object file. 

−nowarn Suppresses all warning messages. Equivalent to

−O0 Disables all optimizations. Does not check for unassigned variables. 

−O1 Enables local optimizations and recognition of common subexpressions.  The call graph determines the order of compilation of procedures. 

−O2 Enables global optimization and all −O1 optimizations.  This includes code motion, strength reduction and test replacement, split lifetime analysis, code scheduling, and inlining of arithmetic statement functions. 

−O3 Enables additional global optimizations that improve speed (at the cost of extra code size), for example: integer multiplication and division expansion (using shifts), loop unrolling, and code replication to eliminate branches.  Also performs all −O2 optimizations. 

−O4 or −O Identical to the −O3 flag.  This is the default.  However, if you specify the −g flag, the default is (See also the −g2 or −g flag.) 

−o output Names the final output file output. 

−p0 Does not permit any profiling.  If loading occurs, the standard run-time startup routine (crt0.o) is used, and the profiling libraries are not searched.  This is the default. 

−p1 or −p Sets up profiling by periodically sampling the value of the program counter.  This flag affects only the loading.  When loading occurs, this flag replaces the standard run-time startup routine with the profiling runtime startup routine (mcrt0.o) and searches the level 1 profiling library (libprof1.a). 

When profiling occurs, the startup routine calls monstartup() and produces the file mon.out, which contains execution-profiling data for use with the postprocessor prof(.).

-relax_key_checking
 
By default, (1) the number of keys with which a file is opened must be the same as the number of keys with which it was created, and (2) keys must match on whether duplicates are allowed.  With the
 
flag, a file can be opened with fewer keys (not more, however) than the number with which the file was created; and keys need not match on whether duplicates are allowed. This flag will provide correct results only in those cases where the unspecified keys are USAGE DISPLAY PIC X.  The checks for key type, size, and offset are unaffected by the flag.
 

-rkc Equivalent to

-rsv [no]xopen
Controls whether or not the compiler recognizes  reserved words defined by the COBOL X/Open  Portability Guide.  Use if your program uses one or more of the X/Open  reserved words as an identifier.  Do not use if your program uses the RETURN-CODE special register.  The default is

The X/Open reserved words are AUTO, BACKGROUND-COLOR, BELL, BLINK, EOL, EOS, ERASE, FOREGROUND-COLOR, FULL, HIGHLIGHT, LOWLIGHT, REQUIRED, RETURN-CODE, REVERSE-VIDEO, SCREEN, SECURE, and UNDERLINE. 

-rsv [no]foreign_extensions
Controls whether or not the compiler recognizes reserved words used by certain foreign extensions (language constructs that are not part of Compaq COBOL).  Use if you want the compiler to output specific diagnostics for foreign extensions to assist you in porting to Compaq COBOL from other COBOL dialects.  Do not use this option if your program uses any of the foreign_extensions reserved words as user-defined words.

The reserved words recognized for foreign_extensions are: ADDRESS, CHANGED, CORE-INDEX, DBCS, DISP, DISPLAY-1, EJECT, ENTRY, EXAMINE, EXHIBIT, GOBACK, ID, KANJI, NAMED, NOTE, OTHERWISE, PASSWORD, POSITIONING, RECORDING, RECORD-OVERFLOW, RELOAD, REORG-CRITERIA, RETURNING, SERVICE, SKIP1, SKIP2, SKIP3, TRACE, and TRANSFORM. 

-seq Controls whether the compiler produces a sequence check on the line numbers in columns 1 through 6 of the source program.  Source programs written in terminal format always pass the sequence check. By default, sequence checking is suppressed. 

-sequence_check
Equivalent to

−shared Produces a dynamic shareable object for inclusion in a shared library.  The linker will produce a shareable object that other dynamic executables can use at run time. If you also specify the −c option, a .o file is created; otherwise, a .so file is created.  The default is −call_shared. 

-show code Equivalent to

-show copy Equivalent to

-show xref Equivalent to

−std Equivalent to This is the default. 

−std 85 Causes the compiler to generate code according to the ANSI 1985 COBOL standard (rather than the 1974 standard).  This is the default.  Produces informational messages associated with specific language features.  To receive the informational messages, you must also specify or (Also see

−std v3 Produces code in the manner of Version 3.4 of VAX COBOL in specific instances, and issues  informational messages for language constructs  that will cause different run-time results if was specified.  The default is  nov3.  To receive the informational messages, you must also specify or

When you specify in the following six specific instances,  DEC COBOL exhibits behavior that is consistent with the ANSI 1985  COBOL standard:

a. When evaluating subscripts in STRING, UNSTRING, INSPECT  (Format 3), and the REMAINDER phrase of the DIVIDE statement. 

b. When evaluating reference modification in STRING, UNSTRING,  and INSPECT (Format 3) statements. 

c. When evaluating the order of identifiers in some PERFORM  (Format 4) statements. 

d. When interpreting PIC P items in some move and comparison  operations. 

e. When determining the size of variable-length tables in some  MOVE statements. 

f. When you specify in the following four specific  instances, Compaq COBOL exhibits behavior that is identical to the  VAX COBOL Version 4.0 and higher behavior when specifying

a. EXIT PROGRAM statement in a main program

If you specify the compiler treats an EXIT PROGRAM  statement as a return in both main programs and subprograms. Specify to bypass an EXIT PROGRAM statement in the  body of a main program and execute the statements following the  EXIT PROGRAM statement.  If the program is a subprogram, the EXIT  PROGRAM statement acts as a return to the program that called the  subprogram. 

b. I-O file status values

c. No Valid Next Record condition

If all of the following conditions exist: (1) The no valid next record (NVNR) condition exists; (2) your program attempts a sequential READ statement; (3) your program includes an AT END branch associated with the READ statement; and (4) you specify the following sequence occurs:

(1) The file status variable, if any, for the file is set  to 16; (2) the statements associated with the AT END statement are  executed; and (3) the program continues to execute normally. 

If you specify the following sequence occurs: (1) The file status variable, if any, for the file is set  to 46; (2) the statements associated with the AT END statement are  not executed; and (3) the program terminates execution abnormally (unless you  have provided for this situation with a Declaratives USE  AFTER STANDARD EXCEPTION procedure). 

d. Opening nonoptional files in OPEN I-O and EXTEND modes

If you specify the compiler creates nonoptional  files opened in I-O or EXTEND mode, if the file is unavailable. If you specify the compiler does not create  nonoptional files opened in I-O or EXTEND mode if the file is  unavailable; instead, the I-O system issues a run-time error. 

Specifying with the flag instructs the compiler to produce code according to the 1974 ANSI standard for certain constructs that are supported by the Federal Information Processing Standards Publication 21-1  (FIPS-PUB 21-1), issued  by the U.S. National Institute for Standards and Technology (NIST), interpretation of file  status.  Specifying without the flag ensures  version to version compatibility for COBOL. 

−std [no]syntax
The syntax option produces informational diagnostics on language features that point out Compaq extensions to the  ANSI 1985 COBOL Standard.  The default is nosyntax.  To receive the informational messages, you must also specify or

−std [no]xopen
The flag produces code for default file-sharing behavior in the manner of the X/Open CAE specification for the COBOL language.  The default is

−std [no]mia
The option produces informational diagnostics on language elements which do not conform to the MIA (Multivendor Integration Architecture) specifications.  The default is

−T num Tells ld() to set the text segment origin.  If num starts with a hexadecimal letter, precede it with the digit "0". 

−taso This flag tells the linker that the executable should be loaded in the lower 31-bit addressable virtual address range.  The and flags to the ld(1) command can also be used to ensure that the text and data segments addresses, respectively, are loaded into low memory.   The flag, however, in addition to setting default addresses for text and data segments, also causes shared  libraries linked outside the 31-bit address space to be appropriately relocated by the loader.  If you specify and also specify text and data segment addresses with and those addresses override the default addresses.   The flag is useful for porting 32-bit programs to Tru64 UNIX. 

-tps Specifies that files are part of a transaction processing system and enables Encina SFS record storage for applicable files. 

-trunc Controls how the compiler stores values in COMPUTATIONAL receiving items if high-order truncation is necessary. If you specify the compiler truncates values according to the number of decimal digits specified by the PICTURE size. This increases program execution time.  By default, the flag is turned off. 

−V Creates a listing file of the source file with various compile-time information appended. The name of the listing file is the basename of the source file with .lis substituted for the .cob, .COB, .cbl, or .CBL.  Equivalent to

If you compile several source files together, a separate listing file is created for each input file (named with the basename of the input file and the .lis suffix). 

−v Prints the passes as they execute with their arguments and their input and output files; also prints final resource usage in the C shell time format.

−w Suppresses all warning messages.  Equivalent to the −nowarn and the −warn none flags. 

-warn Equivalent to The default is

If you specify a flag option, the default options do not  change unless they are individually modified. 

-warn all Causes the compiler to print warning and informational messages as well as error and severe error messages. 

Specifying or with the flag option instructs the compiler to produce  and print informational messages on language features that point out Compaq extensions to the ANSI 1985 COBOL Standard. 

-warn [no]informational
Produces additional informational messages. The default is noinformational.

Specifying or with the flag option instructs the compiler to produce  and print informational messages on language features that point out Compaq extensions to the ANSI 1985 COBOL Standard. 

Specify to receive the FIPS messages about Compaq extensions that the compiler produces when you specify [option]. 

-warn [no]other
Produces warning messages as well as error and severe error messages. This is the default.

-warn none Omits the listing of all messages. 

−xref Directs the Compaq COBOL compiler to generate a data file that the DEC FUSE Database Manager uses to create a cross-reference database file.  This improves the performance of the DEC FUSE Call Graph Browser and Cross-Referencer, which use the database file for their operations.  See the DEC FUSE Handbook for more information on the FUSE cross-reference database and the DEC FUSE Cross-Referencer and Call Graph Browser. 

−xref_stdout
Directs the compiler to output the data file to standard output.  (See
 
 

NOTES

The Reformat utility is available for converting files from ANSI format to terminal format, and vice versa.  After invoking this utility, you will be prompted for input and output file names, and so forth.  To invoke Reformat, type: /usr/lib/cmplrs/cobol/reformat. 

Standard libraries are loaded with the loader option and not a full pathname.  The wrong library can be loaded if there are files with the same name in the directories specified with the −L loader option, or in the default directories searched by the loader. 

ERRORS

The cobol command produces diagnostic messages that are intended to be self-explanatory.  The loader can also produce occasional messages.

FILES

   file.cob - input file
   file.o   - object file
   a.out    - loaded output
   /usr/lib/cmplrs/cobol/dcobol - COBOL compiler

RELATED INFORMATION

   ANSI X3.23-1985 Programmer’s Guide
   Compaq COBOL Reference Manual
   Compaq COBOL User Manual
   Compaq COBOL Release Notes, in /usr/lib/cmplrs/cobol/relnotes
   as(1), cc(1), decladebug(1), ld(1), pixie(1), prof(1), what(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026