HP 3000 Manuals

Control Options [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

Control Options 

Control options are used with the $CONTROL command.  Control options fall
into these three categories:

   *   MPE XL specific control options that depend on the MPE XL
       operating system.  These options work for HP COBOL II/XL but not
       other COBOL versions.

   *   Control options that work for both HP COBOL II/XL and other COBOL
       versions, but they work differently.

   *   Obsolete control options, which HP COBOL II/XL no longer supports.

MPE XL-Specific Control Options 

This section explains MPE XL-specific control options that depend on the
MPE XL operating system and therefore work for HP COBOL II/XL but not for
other COBOL versions.  They are:

   *   CALLINTRINSIC
   *   CMCALL
   *   INDEX16
   *   INDEX32[REV BEG]
   *   NLS[REV END]
   *   OPTFEATURES
   *   OPTIMIZE[REV BEG]
   *   POST85[REV END]
   *   RLFILE
   *   RLINIT[REV BEG]
   *   SYMDEBUG=XDB[REV END]
   *   VALIDATE
   *   NOVALIDATE

CALLINTRINSIC.   

The CALLINTRINSIC option is an aid for migration of HP COBOL II/V
programs containing intrinsic calls into HP COBOL II/XL programs.  The
option causes the compiler to check all called subprograms to determine
whether or not they are intrinsics.  A warning message is generated each
time the compiler locates intrinsics that are called using CALL
statements lacking the INTRINSIC parameter.  In addition, the compiler
generates code in each of these cases, and assumes that the call was to
an intrinsic (not to a user program).  Use this option for migration only
because it extends compilation time.

CMCALL.   

The CMCALL option is provided as a tool for migration from MPE V to MPE
XL based systems.  This option affects all external names except those
generated by a CALL identifier statement.  An external name is generated
according to the following rules:

   *   Hyphens within names are removed.
   *   Uppercase characters are converted to lowercase.
   *   Names are truncated to 15 characters.

If CMCALL is specified, the HP COBOL II program can only call or be
called by the following kinds of programs:

   *   COBOL programs compiled with the CMCALL option.
   *   Programs run in compatibility mode.
   *   Programs written in other languages that depend on the above rules
       holding true.

If the CMCALL option is not specified, external names are generated
according to the default naming conventions.  Refer to "External Names"
in the section on "Interprogram Communication" later in this appendix.

INDEX16 and INDEX32.   

These parameters are used to allocate storage for index data items.
(Refer to the section "USAGE Clause" in Chapter 7  for information
about index data items.)

32 bits (4 bytes) of storage are allocated for each index data item.
32-bit index data items are fully functional as described in the Chapter
7 , "Data Division."

You cannot use index data items having 16 bits of storage allocated to
them that come from non-COBOL II/XL files.  Specify this option only when
reading a record that contains an index data item that was created on a
computer having 16-bit architecture.  The option causes the byte offsets
of the other fields in the record to remain the same as those on the
computer on which it was created.
[REV BEG]

NLS.   

The $CONTROL NLS (Native Language Support) compiler option provides
support for international (multi-byte or non-ASCII) characters in certain
character operations.  For more information on NLS, refer to the Native 
Language Programmer's Guide.  Th NLS option makes string comparisons
sensitive to international character sets and allows input and output of
international characters.

Syntax.   

              {ON      }
$CONTROL NLS= {OFF     }
              {LITERALS}
              {COMPARE }
[REV END]

[REV
BEG]

ON                    Enables NLS support for both string literals and
                      comparisons.  This provides the same service that
                      both the LITERALS value and the COMPARE value
                      provide.

OFF                   Disables NLS support.  This is the default value.

LITERALS              Enables handling of international characters in
                      string literals during compilation of an HP COBOL
                      II program.  LITERALS and COMPARE are mutually
                      exclusive.  Use NLS ON to enable LITERALS and
                      COMPARE at the same time.

COMPARE               Enables relation condition comparison of
                      non-numeric operands to be sensitive to the
                      character set (and associated collating sequence)
                      that you select.  LITERALS and COMPARE are mutually
                      exclusive.  Use NLS ON to enable LITERALS and
                      COMPARE at the same time.

                      Editing inserts the appropriate single-byte
                      DECIMAL-POINT, comma, and single-byte
                      CURRENCY-SIGN.

                      ACCEPT...FREE requires the appropriate
                      DECIMAL-POINT for numeric data.

Location.   

This compiler option can only appear once in your program:  on the first
line or in the INFO string.

Default.   

The default for this option is OFF.

Limitations.   

The environment variable NLDATALANG must be set at both compile time and
run time.  The values set at compile time and at run time can be
different.  For example, the following sets NLDATALANG to Norwegian:

     :SETJCW NLDATALANG 10

Some of the other values for NLDATALANG are:

          Table H-5.  Values for NLDATALANG Environment Variable 
---------------------------------------------------------------------------------------------
|                                             |                                             |
|                  Language                   |              NLDATALANG Value               |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Native-3000 (Default)                       | 00                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| American                                    | 01                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Canadian-French                             | 02                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| English (British)                           | 05                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| French                                      | 07                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| German                                      | 08                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Italian                                     | 09                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Japanese                                    | 221                                         |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Norwegian                                   | 10                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Spanish                                     | 12                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Swedish                                     | 13                                          |
|                                             |                                             |
---------------------------------------------------------------------------------------------

[REV END][REV BEG]

For more values and more information on NLDATALANG, refer to the Native 
Language Support Reference Manual.

Using $CONTROL NLS decreases both compile-time and run-time performance
in some cases and always reduces the backwards compatibility of your
programs.

Only single-byte CURRENCY-SIGNs and single-byte DECIMAL-POINTs
are supported.  Their values are overridden by NLS, not by the
program-collating sequence.

Comparisons by indexed sequential files are done in the collating
sequence specified during their creation in KSAMUTIL. By default, HP
COBOL II/XL creates KSAM files with an ASCII (binary) collating sequence.

International characters are not supported in macros or in preprocessor
commands, such as PAGE, TITLE, VERSION, and COPYRIGHT.

International characters are also not supported in COPY REPLACING or
REPLACE. These characters cannot be on any line containing embedded COPY
or REPLACE character strings or in COPYLIB with REPLACING if any tokens
on that line are replaced.  International characters are supported in the
following COBOL functions:  MAX, MIN, ORD-MAX, and ORD-MIN. The compiler
does not support international characters in the following COBOL
functions:  CHAR, LOWER-CASE, ORD, and UPPER-CASE. These functions use
the current COBOL program collating sequence, which defaults to the ASCII
character set.

Operations on data items that contain international characters are
completed in the same manner as if the characters are ASCII. These
include the following:

   *   Reference modification on MOVEs and compares.
   *   INSPECT (TALLYING, REPLACING, CONVERTING).
   *   EXAMINE.
   *   STRING and UNSTRING.
   *   Class conditions for user-defined classes, except "alphabetic"
       clauses.
   *   Relation conditions with figurative constants.
   *   Display international characters.

Example 1.   

This example displays international characters.  Substitute # signs with
NLS characters to make this example work.

     001000$CONTROL NLS=ON
     001100 IDENTIFICATION DIVISION.
     001200 PROGRAM-ID. EXAMPLE.
     001700 DATA DIVISION.
     002300 WORKING-STORAGE SECTION.
     002400 01 NLS-FIELD PIC X(08) VALUE  "G#K#".
     002600 PROCEDURE DIVISION.
     002700 NLSEXAMPLE.
     002800     DISPLAY "NLS-FIELD is initialized to ", NLS-FIELD.
     002900     DISPLAY "NLS literals can also be used in COBOL "
     003000             " programs as follows :".
     003100     DISPLAY "   The following DISPLAY statement uses NLS string."
     003200     DISPLAY "        A#K#B".
     003300     DISPLAY "   Characters between A and B are NLS characters.".
     003400     STOP RUN.
[REV END][REV BEG]

Example 2.   

This example compares two NLS strings.  Substitute # signs with NLS
characters to make this example work.

     001000$CONTROL NLS=ON
     001100 IDENTIFICATION DIVISION.
     001200 PROGRAM-ID. EXAMPLE1.
     001700 DATA DIVISION.
     002300 WORKING-STORAGE SECTION.
     002400 01 NLS-FIELD PIC X(08) VALUE  "G#K#".
     002410 01 NLS-FIELD-1 PIC X(06) VALUE  "G#K#".
     002500 01 NLS-FIELD-2 PIC X(6) VALUE  "G#K#".
     002600 PROCEDURE DIVISION.
     002700 NLSONEXAMPLE.
     004700 IF NLS-FIELD <> NLS-FIELD-2
     004800    DISPLAY "Fields of different lengths are not identical"
     004801 ELSE
     004802    DISPLAY "Fields of different lengths are identical"
     004803 END-IF.
     004804
     004810 IF NLS-FIELD-1 <> NLS-FIELD-2
     004820    DISPLAY "Same length fields are not identical"
     004830 ELSE
     004840    DISPLAY "Same length fields are identical"
     004850 END-IF.
     004860
     004900 MOVE "aa" TO NLS-FIELD NLS-FIELD-2.
     005000 IF NLS-FIELD = NLS-FIELD-2
     005100    DISPLAY "strings are identical"
     005200 ELSE
     005300    DISPLAY "strings with ascii characters are not identical"
     005400 END-IF.
     005500 STOP RUN.
[REV END]

OPTFEATURES.   

The OPTFEATURES option for the $CONTROL command allows you to make your
programs run faster by generating more efficient code.

Syntax.   

     $CONTROL OPTFEATURES = [CALLALIGNED[16]] [LINKALIGNED[16]]

If both CALLALIGNED and LINKALIGNED are specified, you must separate them
with a space.
[REV BEG]

By default, the compiler expects parameters passed to subprograms by 
reference to be byte-aligned.  The compiler generates extra code in the
called program to move byte-aligned data to temporary storage that is
32-bit aligned (or 16-bit aligned) when required by arithmetic
expressions.

When LINKALIGNED is specified, the compiler generates code that expects
parameters in the LINKAGE SECTION (01s and 77s) to be 32-bit aligned.  If
LINKALIGNED16 is specified, the compiler generates code for 16-bit
alignment.  The LINKALIGNED options are not meaningful for main programs.
The compiler generates more efficient code for accessing formal
parameters when you specify one of these options.  If you do not specify
a LINKALIGNED option, the compiler generates code that assumes the
parameters are on byte boundaries (see "BOUNDS" later in this section for
details).

When CALLALIGNED is specified, the compiler checks the alignment of all
identifiers in the USING phrase of CALL statements.  An error message is
issued for parameters not on a 32-bit boundary.  If CALLALIGNED16 is
specified, the compiler checks for 16-bit boundaries.  Once you have
changed the alignment of the flagged parameters, you can remove the
CALLALIGNED option.  Subprograms written in languages other than HP COBOL
II may require parameters to be aligned on 32- or 16-bit boundaries.  The
CALLALIGNED or CALLALIGNED16 option can be used to flag any parameters
that are not properly aligned for the subprogram.[REV END]


NOTE CALLALIGNED does not apply to intrinsic calls. Alignment requirements for intrinsics are always checked when you use the CALL INTRINSIC format of the CALL statement.
[REV BEG] Example. $CONTROL BOUNDS,OPTFEATURES=CALLALIGNED LINKALIGNED, OPTIMIZE=1 [REV END] OPTIMIZE. The OPTIMIZE option specifies the level of object code optimization you want. If your program does not contain the OPTIMIZE option, the object code is not optimized. This is equivalent to specifying optimization level zero.[REV BEG] OPTIMIZE must appear before the IDENTIFICATION DIVISION.[REV END] Syntax. $CONTROL OPTIMIZE [=0] [=1] The following table summarizes the levels of optimization you can request. Table H-6. $CONTROL OPTIMIZE Parameters --------------------------------------------------------------------------------------------- | | | | If you specify: | You get: | | | | --------------------------------------------------------------------------------------------- | | | | Nothing | No optimization. This is the default. | | | | --------------------------------------------------------------------------------------------- | | | | $CONTROL OPTIMIZE=0 | No optimization. This is the default. | | | | --------------------------------------------------------------------------------------------- | | | | $CONTROL OPTIMIZE | Level one optimization. | | | | --------------------------------------------------------------------------------------------- | | | | $CONTROL OPTIMIZE=1 | Level one optimization. | | | | --------------------------------------------------------------------------------------------- [REV BEG] For more information on the OPTIMIZE option, see the HP COBOL II/XL Programmer's Guide.[REV END] [REV BEG] POST85. The POST85 option enables the COBOL functions and makes the word FUNCTION a reserved word. If you use the word FUNCTION as an identifier in your program, you must change it to another word before you can use this option. Otherwise, you get a compile-time error. The COBOL functions were added to the ANSI standard after the 1985 ANSI standard was published. For more information, see Chapter 10 , "COBOL Functions."[REV END] RLFILE and RLINIT. When you compile a program on an MPE XL system, the compiler produces a relocatable object file (file code NMOBJ) for the program. You can then use the HP Link Editor/XL to place the relocatable object file in a relocatable library (file code NMRL). Alternatively, you can direct the compiler to place the relocatable program in a relocatable library directly. The RLFILE option of the $CONTROL command lets you do this. The RLFILE option lets you closely simulate the placing of object modules in a USL file on MPE V systems. When you use RLFILE, the compiler assumes that the formal file designator name of the relocatable library is COBOBJ and that it has a file code of NMRL. The compiler also treats each procedure in the source file as a separate compilation unit and places each of the compilation units into the library as separate relocatable modules. When you use the RLFILE option, you can erase modules in an existing library before placing new modules into it by using the RLINIT option. If you use the RLFILE option, be sure that the output file (if it already exists) is a relocatable library with file code NMRL. If a previous compilation created COBOBJ as a relocatable object file, you must purge it before compiling. For details about RLFILE and RLINIT, see the HP COBOL II/XL Programmer's Guide. [REV BEG] SYMDEBUG=XDB. The SYMDEBUG=XDB option causes the compiler to put symbolic debug information into the object file for use with HP Symbolic Debugger/XL. The main program should include this option if any subprogram includes the option. This option must appear before the IDENTIFICATION DIVISION. If the SYMDEBUG option is used without the "= XDB" phrase, the symbolic debug information is formatted for use with HP TOOLSET/XL instead of with HP Symbolic Debugger/XL.[REV END] VALIDATE and NOVALIDATE. The VALIDATE and NOVALIDATE options allow you to specify whether or not you want the program to check the validity of the data. VALIDATE causes the compiler to generate code for each arithmetic[REV BEG] operation or MOVE and to check for valid decimal digits and signs[REV END] in the data associated with all identifiers having USAGE IS DISPLAY, PACKED-DECIMAL, or COMPUTATIONAL-3 clauses. When a program that was compiled with the VALIDATE option encounters an illegal ASCII or decimal digit, the program aborts and one of the following messages is displayed: Illegal ASCII digit or: Illegal decimal digit Refer to the section "Run-Time Trap Handling" later in this appendix for information about how to handle these errors when they occur. To prevent these errors, use a de-edited MOVE to check that no illegal characters or blanks are placed in a numeric field when moving from an edited field (see the "MOVE Statement" in Chapter 9 for information on de-edited moves). Also, use the NUMERIC class condition to detect invalid digits. NOVALIDATE is the default on MPE XL systems. If you specify NOVALIDATE or do not specify VALIDATE, no validation code is generated. This results in more efficient code. Control Options that Work Differently This section describes control options that work for both HP COBOL II/XL and other COBOL versions, but work differently. They are: * ANSISUB * BOUNDS * CODE * USLINIT ANSISUB. ANSISUB specifies that the source code is a subprogram that strictly conforms to the ANSI standard (refer to "$CONTROL Command" in Appendix B for more information on ANSISUB). In HP COBOL II/XL, there is no run-time performance penalty for specifying ANSISUB. The DATA DIVISION is not written to a file between calls in HP COBOL II/XL as it is in HP COBOL II/V. The calling program can CANCEL a subprogram that is compiled with this option, if necessary. The program file of a program compiled with ANSISUB is larger because it contains code to reinitialize the DATA DIVISION if the subprogram is cancelled. BOUNDS. In addition to its normal functionality (described in Appendix B ), the control options BOUNDS and OPTFEATURES=LINKALIGNED (or LINKALIGNED16) provide run-time checking of the LINKAGE SECTION. When you specify both the BOUNDS and LINKALIGNED options in a $CONTROL command, the compiler generates code that checks whether or not all the parameters passed to a subprogram are aligned on 32-bit or 16-bit boundaries. If a parameter is not aligned on a 32-bit or 16-bit boundary, a run-time trap occurs. (See the section "Run-Time Trap Handling" for more information.) In cases when a program contains illegal PERFORM statements, the compiler issues an error message if these statements would cause the program to abort during execution. Illegal PERFORM statements cause a program to abort in the following situations: * When the program contains too many indirectly recursive PERFORM statements. * When the program uses too many GO TO statements to get out of PERFORMed paragraphs. * When the program has too many PERFORM statements with common exit points. [REV BEG] See the section "Language Dependencies" later in this appendix for more information on illegal PERFORM constructs.[REV END] CODE. The CODE parameter requests a copy of the assembly language listing of the object code written to the temporary file, COBASSM. This object code is a listing of the machine code generated by the compiler. USLINIT. [REV BEG] USLINIT is ignored in HP COBOL II/XL programs. Object files are always initialized by the HP COBOL II/XL compiler. See the section "RLFILE and RLINIT" for relocatable library files.[REV END] Obsolete Control Options Obsolete control options are no longer supported by HP COBOL II/XL. They are: * ANSIPARM * BIGSTACK * SORTSPACE The compiler issues a questionable error message when it encounters these control options and ignores them. Delete these options from your HP COBOL II source files.


MPE/iX 5.0 Documentation