PreviousConverting an RM/COBOL Application RM/COBOL Conversion IssuesNext"

Chapter 6: RM/COBOL Source Compatibility

This chapter describes the directives you may need to set to successfully submit your RM/COBOL programs to this COBOL system. It also describes the treatment of data types by the system.

6.1 The RM Directive

By default, the standard COBOL language supported by this system, as documented in your Language Reference, already supports much of the RM/COBOL syntax and behavior. You can, however, enable some additional RM/COBOL syntax, using the RM system directive. Setting the RM directive when you submit your RM/COBOL source programs to this COBOL system, ensures that most of the programs are accepted the first time they are submitted. The additional syntax enabled by the RM directive is documented in your Language Reference - Additional Topics.

If you normally set the ANSI switch when you submit your RM/COBOL source programs to the RM/COBOL system, you must specify the ANSI parameter with the RM directive when you submit these programs to this COBOL system.

See your Object COBOL User Guide for the commands you use to submit your RM/COBOL source programs to this COBOL system, and to set the RM directive.

Setting the RM directive automatically sets additional system directives, namely NOTRUNC, OLDINDEX, NOOPTIONAL-FILE, RETRYLOCK, ALIGN"2" and SEQUENTIAL"LINE". See your Object COBOL User Guide for details of these directives. The system will also behave as if you had specified the following syntax:

sign trailing separate

for signed numeric data items, and:

lock mode is automatic

for each file in the program which has no explicit locking syntax declared. When you set the RM directive with the ANSI parameter, the same system directives are set as for the RM directive, except that the SEQUENTIAL directive is set as SEQUENTIAL"RECORD". Also, the system behaves as if you had specified the syntax:

sign trailing included

for signed numeric data items, and:

lock mode is automatic

for each file in the program which has no explicit locking syntax declared.

We also recommend that you set the NOMF and NOOSVS directives when you submit your RM/COBOL source programs to this COBOL system. This ensures that only those words which are treated as reserved words under the ANSI '74 COBOL standard are regarded as reserved words by this COBOL system. For further details of these directives, see your Object COBOL User Guide.

Setting the NORM directive disables the syntax enabled when the RM directive was set, and automatically resets the additional system directives to NOSPZERO, TRUNC"ANSI", NOOLDINDEX, OPTIONAL-FILE, NORETRYLOCK, ALIGN"8" and SEQUENTIAL"RECORD". Additionally, the system behaves as if you had specified the syntax:

sign trailing included

for signed numeric data items, and:

lock mode is exclusive

for each file in the program which has no explicit locking syntax declared. See your Object COBOL User Guide for details of the default setting of the RM directive. The final states of the additional directives set when you use the NORM directive are not necessarily the same as their initial default states.

6.2 Perform Statements

PERFORM statements are not treated in the same way by both COBOL systems. This COBOL system uses a stack-based perform handling system, while the RM/COBOL system associates a return address with a specific procedure name. As a result, under the RM/COBOL system, all end-points to PERFORM statements are always active until they are used. However, under this system, only the end-point of the last PERFORM statement is active at any one time.

You must set the PERFORM-TYPE directive with the RM parameter if this COBOL system is to emulate the behavior of RM/COBOL PERFORM statements. See your Object COBOL User Guide for details.

6.3 Table Bound Checking

If you try to run a program under this COBOL system which contains a subscript value greater than the size of the table to which it refers, the run-time system will produce an error indicating this. Under the RM/COBOL system, however, no such table bound checking is done. Therefore, if you wish to disable table bound checking in this COBOL system, you must use the NOBOUND directive. See your Object COBOL User Guide for details of this directive.

If you use the NOBOUND directive when running intermediate code, you will be able to access data beyond a table's bounds by using a subscript value greater than the table size. Use of the NOBOUND directive when you are producing intermediate code will also disable bound checking when running generated code. However, if you wish to access data beyond a table's bounds when running generated code, you must also use the directive NOBOUNDOPT.


Note: When you use the NOBOUNDOPT directive, performance will be impaired.


6.4 Types of Data

The treatment of data types by this COBOL system is associated with the action of the file conversion utility, Convert3. This COBOL system always allocates the same number of bytes to the item in question, but may redefine its contents when it is converted. Therefore, you must be aware that if these items are redefined, and the program logic expects to find a certain binary value in the redefinition, you may not receive the behavior you are expecting at run time. At run time, this COBOL system may treat the ON SIZE ERROR clause differently from the RM/COBOL system. See the chapter RM/COBOL Conversion Problem Solving for further details.

The following sections define how this COBOL system treats COMPUTATIONAL, COMPUTATIONAL-1 and COMPUTATIONAL-6 types of data.

6.4.1 COMPUTATIONAL (COMP) Data Types

This COBOL system treats any COMP data items in your RM/COBOL source program as the standard Micro Focus COBOL DISPLAY format. The difference in the internal representation of such data in the two systems is that this COBOL system always sets the most significant four bits of each byte to the value 3, while the RM/COBOL system always sets such bits to the value 0.

For example, under the RM/COBOL system:

PIC 999 COMP VALUE 123

is held in three bytes as hexadecimal value 01 02 03

while under this COBOL system:

PIC 999 VALUE 123

is held in three bytes as hexadecimal value 31 32 33.

6.4.2 COMPUTATIONAL-1 (COMP-1) Data Types

For each data item declared as USAGE COMP-1 in your RM/COBOL source program, regardless of its picture-string, this COBOL system allocates a 2-byte signed binary data item. This data item is capable of holding a hexadecimal value in the range -32768 to +32767. That is, this COBOL system treats each RM/COBOL USAGE COMP-1 data item as though it had a standard Micro Focus COBOL picture-string of S9(4) COMP. See your Language Reference - Additional Topics for details on the standard Micro Focus COBOL language.

6.4.3 COMPUTATIONAL-6 (COMP-6) Data Types

This COBOL system treats any COMP-6 data items in your RM/COBOL source program as the standard Micro Focus COBOL COMP format. If, as a result of this, less data space is allocated to each item than would be under the RM/COBOL system, this COBOL system pads the space with a byte containing a zero, as shown in the following table:

Table 6-1. COMP-6 to COMP Conversion

RM COMP-6 PICTURE clause Bytes allocated when converting to Micro Focus COBOL COMP PICTURE clause Number of bytes containing leading zeros
required to precede COMP PICTURE clause
9(1) 1 NONE
9(2) 1 NONE
9(3) 2 NONE
9(4) 2 NONE
9(5) 3 NONE
9(6) 3 NONE
9(7) 4 NONE
9(8) 4 NONE
9(9) 5 NONE
9(10) 5 NONE
9(11) 5 1
9(12) 5 1
9(13) 6 1
9(14) 6 1
9(15) 7 1
9(16) 7 1
9(17) 8 1
9(18) 8 1

The padding byte precedes the converted field, and is therefore included in any redefinition of group fields which contain the converted field. However, the padding byte would not be included if you redefined only the converted field. If you wish to ensure that the padding byte is included in the redefinition of the converted field, you must add a field at a higher level immediately before the converted field, and redefine this new field instead.


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

PreviousConverting an RM/COBOL Application RM/COBOL Conversion IssuesNext"