HP 3000 Manuals

Operation [ Micro Focus COBOL System Reference, Volume 2 ] MPE/iX 5.0 Documentation


Micro Focus COBOL System Reference, Volume 2

Operation 

This section describes how to invoke your program, specifying any
switches required to control its behavior.

Invoking Your Program 

The syntax for invoking a statically or dynamically linked module varies
slightly from that for invoking a dynamically loadable module.  The
command line for running each type of program is described below.

Statically Linked Module.   

To invoke a statically linked module,enter the following command line at
the system prompt:

module-name [program-params]

where:

module-name         is the name of an a.out moduleoutput by the cob
                    command.  See the chapter COBOL System Interface 
                    (cob) for details on creating this type of file.

program-params      is one or more parameters that are required by the
                    program.  Each parameter is a string, separated from
                    adjoining parameters by one or more spaces.  If any
                    of the parameters contain an equal sign, cobrun maps
                    this to parentheses as these have a special meaning
                    to UNIX, whereas the equal sign does not.  These
                    parameters can be read by the program in a number of
                    ways.  See the chapter Writing Programs in your COBOL 
                    User Guide for further details.

Dynamically Linked Module.   

Dynamically linked modulesare invoked in the same way as statically
linked modules.  However, you must first set the LD_LIBRARY_PATH
environment variable.  See the appendix Micro Focus Environment Variables 
for details.

Dynamically Loadable Program.   

To run dynamically loadable (.int and .gnt) programsoutput by the cob
command, enter the following command line at the system prompt:

cobrun [(switch-param)] program-name [program-param]

where:

switch-param        is one or more programmable and run-time switches
                    that control events in a program at run time (see the
                    section Switch Parameters in this chapter).

program-name        is the name of either the intermediate (.int) code or
                    the generated (.gnt) code fileof the program output
                    by the cob command.  See the chapter COBOL System 
                    Interface (cob) for details on creating these types
                    of files.  If both .int and .gnt versions of the file
                    exist and you do not specify an explicit file
                    extension in the cobrun command, then by default, the
                    .gnt version is run.

program-param       is as defined in the section Statically Linked 
                    Module.

Switch Parameters.   

A switch is a parameter you pass to the run-time system to control the
behavior of your program at run time.  These switches fall into two
categories:  programmable switches and run-time switches.  A full listing
and description of the switches available are contained in the appendix
Descriptions of Run-time Switched.

Programmable Switches.   

Programmable switchesconsist of a digit in the range 0 through 8.  These
switches correspond to the COBOL switchesthat you define in the
Special-Names paragraph of your program, enabling you to set these
switches on or off when your program begins executing.  For details of
how to use the COBOL switches, see your Language Reference.

Run-time Switches.   

Run-timeswitches are acted on by the run-time system itself.  Each
consists of an upper- or lower-case letter.  These switches affect
optional aspects of the behavior of certain COBOL features at run time.

Setting .   

Switches

Switches, which you specify before running your program, can be setusing
the COBSW environment variable.  Alternatively, if you are running a
dynamically loadable program, you can set them on the cobrun command
line; however, we recommend that you use COBSW instead.

To set a programmable switch or run-time switch on , precede it with a
plus sign (+); to set it off, precede it with a minus sign (-).

If you do not explicitly set any switches either in the COBSW environment
variable or on the cobrun command line, then their default values, as
shown in the section Switches Available, will apply.

The above rules are summarized in the following two diagrams.

The format for setting switches in COBSW is:

[]
The format for setting switches on the command line is:
[]
where:
[]
indicates a programmable or run-time switch, and sets the switch s on or off, respectively. S is either a programmable switch with a digit in the range 0 - 8, or an alphabetic switch with an upper- or lower-case letter.
NOTE You should note the following when setting switches: * all switches set on the cobrun command line must be enclosed in a pair of parentheses; parentheses are not used in COBSW * switches may be separated by spaces (but this is not required); however, there must not be a space between the sign ("+" or "-") and its associated switch * switches can be specified in any order, but each individual programmable or alphabetic switch must be preceded by a sign * individual switches may be set more than once, but the last setting of any particular switch is the one accepted by the system * switches remain set when COBOL subprograms are called * switches set on the command line take precedence over those defined in the COBSW environment variable * switches are case sensitive.
Examples. Setting COBSW to: COBSW=+1+4 sets the programmable switches as follows: 0 off 1 on 2 off 3 off 4 on 5 off 6 off 7 off 8 off The command: cobrun -2+5-7+7 myprog loads the program myprog from the current directory with programmable switches 5 and 7 on and switch 2 off. Note that since the last setting of switch 7 (that is +7) is the one used, that switch is turned on. Switches 0, 1, 3, 4, 6 and 8, which are not specified, are off by default. Switches Available The switch parameter s can be any of the programmable or run-time switches listed in the following table. The Function column describes the effect of the switch when it is set on, and the Default Setting column indicates the setting that applies if you do not explicitly set the switch. Full details on the function of each of these switches are provided in the appendix Descriptions of Run-time Switches. Table 25-1: Available Switches ---------------------------------------------------------------------------- | | | | | | Switch | Title | Function | Default| | | | | Set- | | | | | ting | | | | | | ---------------------------------------------------------------------------- | | | | | | 0-8 | Programmable | enable or disable COBOL switches | off | | | switches | that you define in the | | | | | Special-Names paragraph of your | | | | | program | | | | | | | ---------------------------------------------------------------------------- | | | | | | A | Animator switch | invokes Animator debugger | off | | | | | | ---------------------------------------------------------------------------- | | | | | | A1 | Base Animator | invokes the base Animator | off | | | switch | | | | | | | | ---------------------------------------------------------------------------- | | | | | | B | Skip Locked Record | enables you to skip locked | off | | | switch | records when sequentially | | | | | accessing a shared file | | | | | | | ---------------------------------------------------------------------------- | | | | | | D | ANSI COBOL Debug | invokes the ANSI COBOL Debug | off | | | switch | module | | | | | | | ---------------------------------------------------------------------------- | | | | | | d | Dynamic Paging | enables you to specify the | 250 | | | Buffer switch | amount of memory in bytes to be | Kbytes | | | | used for the RTS dynamic paging | | | | | buffers | | | | | | | ---------------------------------------------------------------------------- | | | | | | E | Error switch | executes intermediate code | off | | | | output by cob which contains | | | | | S-level compiler errors | | | | | | | ---------------------------------------------------------------------------- | | | | | | e | COBOL Symbol switch | causes RTS to search for C | on | | | | programs and symbols to satisfy | | | | | CALL operations or EXTERNAL data | | | | | items | | | | | | | ---------------------------------------------------------------------------- Table 25-0. Table 25-1: Available Switches (cont.) ---------------------------------------------------------------------------- | | | | | | Switch | Title | Function | Default| | | | | Set- | | | | | ting | | | | | | ---------------------------------------------------------------------------- | | | | | | F | Numeric Field Check | enables various numeric data | on | | | switch | checks at run-time | | | | | | | ---------------------------------------------------------------------------- | | | | | | i | Keyboard Interrupt | enables keyboard interrupts | on | | | switch | (including the suspend key for | | | | | systems that support Job | | | | | Control) | | | | | | | ---------------------------------------------------------------------------- | | | | | | K | Indexed Files | enables sequence checking of | off | | | Sequence Check | indexed keys in ISAM files | | | | switch | | | | | | | | ---------------------------------------------------------------------------- | | | | | | l | Memory switch | enables you to set the size of | max | | | (lower-case L) | available memory | bytes | | | | | avail- | | | | | able | | | | | to RTS | | | | | | ---------------------------------------------------------------------------- | | | | | | N | Null switch | enables null insertion for line | on | | | | sequential files | | | | | | | ---------------------------------------------------------------------------- | | | | | | O | Divide-by-Zero | disables run-time error 48, | on | | | switch | causing program to continue with | | | | | undefined results | | | | | | | ---------------------------------------------------------------------------- | | | | | | p | Dynamic Linkage | causes the RTS to set up the | on | | | Fixup switch | addressability for all the | | | | | Linkage Section items in a | | | | | program when it is called | | | | | | | ---------------------------------------------------------------------------- | | | | | | Q | File Status Error | causes an internal RTS table to | off | | | switch | map all status "9" errors | | | | | reported to your code to a | | | | | status which conforms with | | | | | statuses returned in the COBOL | | | | | dialect of your choice | | | | | | | ---------------------------------------------------------------------------- | | | | | | S | Sort switch | causes SORT to put temporary | off | | | | work files in the directory | | | | | specified by the TMPDIR | | | | | environment variable | | | | | | | ---------------------------------------------------------------------------- | | | | | | s | Sort Memory switch | specifies the amount of memory | off | | | | used as internal workspace when | | | | | performing a SORT operation | | | | | | | ---------------------------------------------------------------------------- | | | | | | T | Tab switch | enables tab insertion upon | off | | | | output for line sequential files | | | | | | | ---------------------------------------------------------------------------- TMPDIR Environment Variable The TMPDIR environment variable enables you to specify a different drive or path in which to store temporary files. This may be necessary if the run-time system needs to page data to disk when creating heaps or sorting. For details of setting the TMPDIR environment variable, see the appendix Micro Focus Environment Variables. Accessing Command Line Parameters You can access program parameters in a number of ways. For example, you can use one of the following formats of the ACCEPT statement: accept data-name from command-line or accept data-name from mnemonic-name where: data-name is the data item to receive the command line parameters. mnemonic-name is defined in the Special-Names paragraph as: command-line is mnemonic-name Full details on the available methods of accessing command line parameters are contained in the chapter Writing Programs in your COBOL User Guide. Example. Running program myprog with the command line: COBSW=+1+7 export COBSW myprog in-file.dat clear will cause the statement: accept cmd-line from command-line in the program to place in-file.dat clear into the data-item cmd-line. Run-time System Error Messages A run-time system error message is returned on a program that is syntactically correct but which encounters problems during the actual running of the program. For example, you could receive such an error if you attempt to access a file in the wrong mode or if you use a corrupt file. Refer to your Error Messages for a description of the format and all the possible run-time system errors.
NOTE If you try to run a program, but the run is not successful, you should be aware that the program counter (pc) values for native code generated files and executable files are undefined.


MPE/iX 5.0 Documentation