PreviousRun-time Configuration Terminfo Database and Terminal DevicesNext

Chapter 15: Descriptions of Run-time Switches

This chapter describes the available programmable and run-time switches. Each entry first describes the effect of the switch when it is set on; unless otherwise specified, the opposite effect can be assumed if the switch is set to off. The default setting that applies if you do not explicitly set any of these switches is also given. Switches can be set either on the command line or in the COBSW environment variable unless otherwise indicated. For further information on setting and testing switches, see the chapter Running.

15.1 Key

The function of each switch is given, followed by these headings:

Properties:
Default: The default setting of the switch.
Comments: Additional information about the switch.
See Also:

Pointers to further information.

15.2 List of Switches

0, 1, 2, ... 8 Programmable switches
A Invoke Animator for intermediate code
A1 Display trailing spaces
B, B1 Skip locked record
D Invoke the ANSI COBOL Debug module
d Set memory size for dynamic paging buffer
E Execute code containing S-level errors
F Validate numeric data in intermediate code
i Enable keyboard interrupts
l Specify memory available for application
L2 Determine record terminator for line sequential files
N Insert nulls in line sequential files
O Enable divide-by-zero error
T Insert tabs in line sequential files
Z Control conversion of DBCS spaces

There are also run-time switches specifically for programs that use the OO programming capabilities of Server Express; for details, see the appendix Descriptions of OO Run-time Switches in your OO Programming with Object COBOL book.

15.3 Descriptions of Switches


Programmable Switches

Sets the corresponding COBOL switch when the program is entered.

Properties:
Default: All off
Comments:

These switches enable the COBOL switches 0 through 8 that you defined in the Special-Names paragraph of your program (see your Language Reference for details). You can specify these switches in any order, but each individual switch must be preceded by a sign.


A - Animator

Invokes Animator to animate an application which is either invoked using the cobrun command or dynamically loaded by a linked module.

Properties:
Default: Off
Comments:

If you want to animate an application created by the cob command directily, you can use the anim command. If you use anim there is no need to set this switch.

If this switch is on, Animator checks the DISPLAY environment variable. If DISPLAY is set, Animator attempts to open a new X window for the Animator at the location specified via the DISPLAY environment variable; otherwise Animator uses the current terminal.


Note: If the +A switch is set then Animator is invoked for any COBOL application that is executed. We therefore recommend that this switch is not set if you are using the SDE.


For more information on starting Animator, see your Debugging Handbook.


A1 - Display Trailing Spaces

Disables the display of trailing spaces by causing DISPLAY ... UPON CONSOLE statements to strip off any trailing spaces in the data item being displayed before outputting the data to the screen.

Properties:
Default: Off
Comments:

This switch provides compatibility with earlier systems from Micro Focus. When this switch is off, the trailing spaces are included in the display, as required by the ANSI COBOL standard.


B, B1 - Skip Locked Record

Causes the record pointer to be updated past any locked record encountered when using the READ NEXT statement.

Properties:
Default: Off
Comments:

Set the B switch for indexed sequential files open INPUT or I-O. Set the B1 switch for indexed sequential files open INPUT. Setting either of these switches permits a file to be sequentially read, even if another process has records locked in that file.

A file status of "locked record" is returned when a locked record is read when the B switch is set; a file status of "00" is returned when a locked record is read when the B1 switch is set.


Note: This switch also affects relative and record sequential files when your program is compiled with the CALLFH directive set.


See Also:

CALLFH Compiler directive


D - Standard ANSI COBOL Debug

Invokes the standard ANSI COBOL Debug module.

Properties:
Default: Off
Comments:

See your Language Reference - Additional Topics for a description of the Debug facilities. This switch must be set on the command line.

Example:

The command:

cobrun[_t] +D myprog

loads the program myprog with the standard ANSI COBOL Debug module invoked.


d - Dynamic Paging Buffer

Specifies the amount of memory in bytes to be used for the run-time system dynamic paging buffers.

Properties:
Default: -d245760 (240 K)
Comments:

Dynamic paging is used by programs such as the Compiler. By increasing the amount of memory you might be able to improve the performance of such programs. Once the amount of memory allocated for dynamic paging is exceeded, the run-time system pages any further requirements onto disk.

For example, when compiling a large COBOL program, the amount of memory for dynamic paging buffers might be exceeded due to the Compiler requiring a large amount of dictionary to store the symbol table it creates. When the dynamic paging buffer space is exhausted, the run-time system starts to page dynamic accesses to disk, which might have a performance overhead. By raising the amount of memory for dynamic buffering, paging to disk can be avoided (or at least reduced) and therefore better Compiler performance achieved.

Example:

To double the amount of memory (to 500k) the run-time system could use before paging to disk, you would set the COBSW environment variable as follows:

COBSW=-d500000
See Also:

dynamic_dictionary_limit run-time tunable


E - Error

Executes intermediate code which contains S-level syntax-check errors.

Properties:
Default: Off
Comments:

If you try to run intermediate code programs which contain S-level Compiler errors when this switch is set to off, you receive a run-time system error. See your Error Messages book for full details of these errors.


F - Numeric Field Check

Checks all numeric items for valid numeric data.

Properties:
Default: On
Comments:

If the data is not valid, run-time system error 163 ("Illegal character in numeric field") is produced. Setting this switch to off suppresses this checking.

This checking is only done on generated code created with the CHECKNUM Compiler directive, and on intermediate code. The run-time system and generated code try to optimize many types of numeric operations. These operations can cause invalid results if the numeric operands do not contain valid numeric data. By default, the run-time system gives the run-time system error 163 when a numeric operation is tried with invalid numeric data.

Invalid data is handled differently by intermediate and native code, by this COBOL system on other environments and different versions of this COBOL system. We recommend that you enable numeric field checking while you are developing your program.

If you receive run-time error 163, we recommend that you adjust your code so that no invalid data is used. You can locate the invalid numeric data in your code by setting the +F switch on and then animating your program until run-time system error 163 is detected.

If you are not able to correct your code, you might want to use one or more of the following Compiler directives to resolve invalid data in numeric fields:

Example:

One of the checks enabled or disabled by this switch is the numeric field check. When the switch is set on, if the run-time system loads an item into one of its numeric registers it first checks whether the loaded value contains a non-numeric character. If it does, run-time error 163 is output. For example,

working-storage section. 
    01 item-a       pic 9.
procedure division.
    If item-a =  0.
        Display "zero"
    else
        display "nonzero"
    end-if.

The variable item-a is not initialized by a VALUE clause, and so contains a space character x"20". Running this program with the F switch set on causes the run-time system to check whether the numeric field contains a non-numeric value resulting in run-time error 163.

See Also:

CHECKNUM Compiler directive
HOST-NUMCOMPARE Compiler directive
HOST-NUMMOVE Compiler directive
HOSTSIGNS Compiler directive
SPZERO Compiler directive
ZWB Compiler directive


i - Keyboard Interrupt

Enables keyboard interrupts. If your system supports Job Control, this switch also enables the Suspend Interrupt key (usually Ctrl+Z).

Properties:
Default: On
Comments:

If you want to disable keyboard interrupts, including the suspend key, for your application, use the -i switch.


l - Memory

Enables you to set the maximum amount of memory to be made available to the run-time system, or to cause the run-time system to perform physical cancels instead of logical cancels.

Properties:
Default: The maximum number of bytes available to the run-time system.
Comments:

This switch is lower-case "L", not upper-case "I".

The format of this switch is lnnnnnn, where nnnnnn is the amount of memory in bytes to be made available to the run-time system.

You can use this switch to limit the amount of memory the run-time system will use. This might be useful to enable you to tune your system.

By default the run-time system performs logical cancels unless all available memory has been used up. As far as your programs are concerned, the behavior of logical and physical cancels is identical, but logical cancels are faster. A logical cancel flushes all file buffers but does not release any memory. To force all cancels to be physical, you must specify this switch with parameter zero; for example:

+l0

By default, when the run-time system requires memory space it checks that the new request does not exceed the available memory. If it does, the memory that should have been freed by any cancels is freed and the run-time system repeats its request for memory. The run-time system loads programs that have been logically canceled in preference to reloading from disk.

Statically linked COBOL programs cannot be physically canceled because they cannot be removed from memory.

Duplicate entry point names are not allowed in statically linked programs; you must ensure that all such programs have unique entry point names.

Logical cancels behave in the same way as these physical cancels under statically linked programs. Therefore, an application developed using .int and .gnt files with logical cancels should exhibit the same behavior when generated as object code files and statically linked. However, if you used physical cancels and duplicated entry point names while developing the application, the application might fail to static link.

See Also:

dynamic_memory_limit run-time tunable


L2 - Record Terminator

Determines the character(s) to be used as the record terminator when reading a line sequential file.

Properties:
Default: Off
Comments:

When off (-L2), x"0A" or "0D0A" is taken as the record terminator. This provides compatibility with COBOL for DOS, Windows and OS/2.

When on (+L2), x"0A" is taken as the record terminator. This provides compatibility with earlier versions of this system, correctly reading files written using a WRITE...AFTER ADVANCING statement.

This switch only affects read operations and not write operations.


N - Null

Enables null insertion for all line sequential files in your program.

Properties:
Default: On
Comments:

This switch is especially useful if the format of your files is incompatible with this version of COBOL.

Setting this switch to on means that when a program writes records to a line sequential file with a record containing control characters (that is, all characters with ASCII codes less than or equal to x"1F"), the system adds a null character (x"00") before each control character. Similarly, on reading a record from a line sequential file, these null characters are stripped from the control characters.

Setting this switch affects only the physical storage of data in a line sequential file. Records written with one setting and read back with the same setting are returned in exactly the same way. However, if you try to read a file with one setting which was written with the other setting, the results are unpredictable.

Setting this switch off enables control characters to be written and read in the same way as other characters.

When the N switch is on:


Note: Control characters depend on the operating system. Their hexadecimal values are always less than x"1F".


When the N switch is off:

Example:

The command:

cobrun[_t] -N myprog

loads the program myprog and specifies that, in line sequential files, all characters less than or equal to x"1F", except for Tab and the file control characters, are treated as data. Null is not inserted before data characters less than x"1F" on output.


O - Divide-by-zero

Enables run-time system error 48 ("Attempt to divide by zero").

Properties:
Default: On
Comments:

A program compiled with CHECKDIV"OSVS", CHECKDIV"VSC2" or CHECKDIV"COBOL370" set produces run-time system error 48 upon an attempt to divide by zero. Setting this switch off (-O) disables this error, causing the program to continue with undefined results. This switch has no effect on programs that were not compiled using one of the above directive settings.

See Also:

CHECKDIV Compiler directive


T - Tab

Enables insertion of tab characters in all line sequential files.

Properties:
Default: Off
Comments:

This switch is especially useful if the format of your files is incompatible with this version of the COBOL system.

On output to disk, multiple spaces before a tab stop position are written as one tab character. The T switch does not affect any trailing spaces as these are not part of the line sequential record, and they are removed on output. Tab positions are every 8 character positions (for example, 9, 17, 25) and cannot be changed.

On input, tab characters are always expanded to spaces to the next position, regardless of the setting of the T switch.

With this switch set to off, all spaces in a line sequential file are written to disk as space characters.


Z - DBCS Space Conversion

Enables conversion of double-byte character set (DBCS) spaces to ASCII spaces when reading a line sequential file or input from the console.

Properties:
Default: Off
Comments:

DBCS spaces such as x"8140" for Shift-JIS and x"A1A1" for EUC in Japanese environments are converted to ASCII spaces x"2020".

See Also:

DBSPACE Compiler directive



Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousRun-time Configuration Terminfo Database and Terminal DevicesNext