HP 3000 Manuals

Operation [ COBOL/HP-UX Operating Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Operating Guide for the Series 700 and 800

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-param]

where:

module-name          is the name of an a.out module output by the cob
                     command.  See Chapter 2 , COBOL System Interface 
                     for details on creating this type of file.

program-param        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
                     ways.  See the section Passing the Command Line in
                     Chapter 10 , Writing Programs for further
                     details.

Dynamically linked module.   

Dynamically linked (.so) modules 
are invoked in the same way as statically linked modules.  However, you
must first set the LD_LIBRARY_PATH environment variable.  See Appendix I
 Environment Variables for details.

Dynamically loadable program.   

To run dynamically loadable (.int and .gnt) programs 
output 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 file of the program
                     output by the cob command.  See Chapter 2 , COBOL 
                     System Interface 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 above.

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 

Programmable switches 
consist of a digit in the range 0 through 8.  These switches correspond
to the COBOL switches 
that 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-Time 
switches 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.

Switches, which you specify before running your program, can be set 
using 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 (-).

For example:

     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

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.

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.

Example 

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.

Setting.   

Switches

The above rules are summarized in the following two diagrams.  The format
for setting switches on the command line is:

[{+}s] ...
[{-} ]
The format for setting switches in COBSW is:

COBSW=[{+}s] ...
      [{-} ]
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.

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 Appendix E , Descriptions of Run-Time Switches.

          Table 7-1.  Available Switches 

---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|  Switch  |       Title       |              Function              | Default/Setting |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|   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       |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    B     | Skip Locked       | enables you to skip locked records |       off       |
|          | Record switch     | when sequentially accessing a      |                 |
|          |                   | shared file                        |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    D     | ANSI COBOL Debug  | invokes the ANSI COBOL Debug       |       off       |
|          | switch            | module                             |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    d     | Dynamic Paging    | allows you to specify the amount   |   250 Kbytes    |
|          | Buffer switch     | of memory in bytes to be used for  |                 |
|          |                   | the RTS dynamic paging buffers     |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    E     | Error switch      | executes intermediate code output  |       off       |
|          |                   | by cob which contains S-level      |                 |
|          |                   | compiler errors                    |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    e     | COBOL Symbol      | causes RTS to search for C         |       on        |
|          | switch            | programs and symbols to satisfy    |                 |
|          |                   | CALL operations or EXTERNAL data   |                 |
|          |                   | items                              |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    F     | Compatibility     | enables various checks at run-time |       on        |
|          | Check switch      |                                    |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    i     | Keyboard          | enables keyboard interrupts        |       on        |
|          | Interrupt switch  |                                    |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    K     | ISAM Files        | enables sequence checking of       |       off       |
|          | Sequence Check    | indexed keys in ISAM files         |                 |
|          | switch            |                                    |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------

          Table 7-1.  Available Switches (continued) 

---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|  Switch  |       Title       |              Function              | Default/Setting |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    l     | Memory switch     | allows you to set the size of      |       ??        |
|          |                   | available memory                   |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    N     | Null switch       | enables null insertion for line    |       on        |
|          |                   | sequential files                   |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    p     | Dynamic Linkage   | causes the RTS to set up the       |       on        |
|          | Fixup switch      | addressability for all the Linkage |                 |
|          |                   | Section items n 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 work  |       off       |
|          |                   | files in the directory specified   |                 |
|          |                   | by the "TMPDIR" environment        |                 |
|          |                   | variables                          |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------
|          |                   |                                    |                 |
|    T     | Tab switch        | enables tab insertion upon output  |       off       |
|          |                   | for line sequential files          |                 |
|          |                   |                                    |                 |
---------------------------------------------------------------------------------------

TMPDIR Environment Variable 

The TMPDIR environment variable allows 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 Appendix I  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 section Passing the Command Line in
Chapter 10 , Writing Programs.

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