Chapter 8: Converting RM/COBOL Data Files

In order to run Convert3 you must supply it with the name of an existing RM/COBOL source program (or COPY-file) that is syntactically correct. This source program must contain the FD and SELECT...ASSIGN entries, with any associated record definitions, concerning the RM/COBOL data file you want to convert.

You must convert all your data files, so that the file structures and their contents can be used under this COBOL system.

8.1 Conversion of Data Types

The Convert3 utility converts COMPUTATIONAL, COMPUTATIONAL-3, COMPUTATIONAL-6 and DISPLAY data from RM/COBOL format to the formats used by this system. The following sections describe how these types of data are converted.

8.1.1 COMP/COMPUTATIONAL Data

The RM/COBOL system represents COMP (or COMPUTATIONAL) data in packed decimal format with one character per byte stored in each least significant four-bits. The most significant half-byte always contains zero. If the picture-string specifies a signed representation, an additional byte is added to the least significant end of the string: a negative value is represented by the hexadecimal value x"D", and a positive value is represented by the hexadecimal value x"B".

Consider the following examples:

Value Picture Clause RM Representation (Hexadecimal)
1234 PIC 9(5) COMP 00 01 02 03 04
1234 PIC S9(5) COMP 00 01 02 03 04 0B
-1234 PIC S9(5) COMP 00 01 02 03 04 0D

The conversion program produced by Convert3 converts COMP data fields into DISPLAY format, with sign trailing separate. This is compatible with this COBOL system's treatment of RM/COBOL COMP fields in the source program when the RM directive is set. See the
chapter Rebuild in the Conversion Series 2 Part for details. If the data item is signed, the sign byte has the most significant half-byte set to hexadecimal value 2.

After conversion, the examples above are represented as follows:

Value Picture Clause This COBOL's Representation (Hexadecimal)
1234 PIC 9(5) DISPLAY 30 31 32 33 34
1234 PIC S9(5) DISPLAY 30 31 32 33 34 2B
-1234 PIC S9(5) DISPLAY 30 31 32 33 34 2D

8.1.2 COMP-3/COMPUTATIONAL-3 Data

The RM/COBOL system represents COMP-3 data in packed decimal format with the least significant half-byte holding the sign.

This sign half-byte contains the following values:

Field RM Sign half-byte value (Hexadecimal)
Unsigned F
Signed, Positive B or F
Signed, Negative D

Consider the following examples:

Value Picture Clause RM Representation (Hexadecimal)
1234 PIC 9(5) COMP-3 00 23 4F
1234 PIC S9(5) COMP-3 00 23 4F
-1234 PIC S9(5) COMP-3 00 23 4D

The only requirement for conversion is that the sign half-byte has to be changed for signed positive fields to hexadecimal value C. After conversion, the examples above are represented as follows:

Value Picture Clause This COBOL's Representation (Hexadecimal)
1234 PIC 9(5) COMP-3 00 23 4F
1234 PIC S9(5) COMP-3 00 23 4C
-1234 PIC S9(5) COMP-3 00 23 4D

8.1.3 COMP-6/COMPUTATIONAL-6 Data

The RM/COBOL system holds COMP-6 data in a similar format to COMP-3 data, except there is no sign half-byte. If a sign is indicated in the picture clause it is ignored and has no effect. The value held is always positive.

Consider the following examples:

Value Picture Clause RM Representation (Hexadecimal)
1234 PIC 9(5) COMP-6 00 12 34
123456 PIC S9(6) COMP-6 12 34 56

In order to maintain the size and capacity of the data items, this COBOL system treats COMP-6 data items as this COBOL's COMP format fields, and pads the field with binary zeros where necessary. After conversion, the examples above are represented as follows:

Value Picture Clause This COBOL's Representation (Hexadecimal)
1234 PIC 9(5) COMP-6 00 04 D2
123456 PIC S9(6) COMP-6 01 E2 40

The 9(5) COMP field is extended by one byte containing binary zero in order to maintain the size of the original item. See the section COMPUTATIONAL-6 (COMP-6) Data Types in the chapter RM/COBOL Source Compatibility for details.

8.1.4 DISPLAY Data

You should be aware of the following differences between the representation of numeric DISPLAY format data items, with sign INCLUDED, under the RM/COBOL system and this COBOL system:

When the RM directive is set, a DISPLAY format data item with no sign clause associated is treated by this system as though you had specified the SIGN TRAILING IS SEPARATE clause. However, when the RM"ANSI" directive is set, the same data item is treated as though you had specified the SIGN TRAILING IS INCLUDED clause. This is the default state for such data items in this COBOL system. The Convert3 utility also allows you to specify the type of sign used for DISPLAY format data items. See the chapter Running Convert3 for details on how you can do this.

Consider the following examples:

Value Picture Clause RM Representation (Hexadecimal)
Leading Trailing
123 PIC 9(3) DISPLAY 31 32 33 31 32 33
123 PIC S9(3) DISPLAY 41 32 33 31 32 43
-123 PIC S9(3) DISPLAY 4A 32 33 31 32 4C

After conversion, these examples are represented as follows:

Value Picture Clause This COBOL's Representation (Hexadecimal)
Leading Trailing
123 PIC 9(3) DISPLAY 31 32 33 31 32 33
123 PIC S9(3) DISPLAY 31 32 33 31 32 33
-123 PIC S9(3) DISPLAY 71 32 33 31 32 73

8.2 Differences Following Conversion

The following section lists slight differences which can occur following conversion of your data files. You do not need to modify your programs.

8.2.1 Indexed Sequential Files with Duplicate Alternate Keys

If you convert an RM/COBOL indexed sequential data file with duplicate alternate keys, the time order of records with duplicate alternate keys is not preserved in the conversion.

8.3 Program Modifications Required by Convert3

The following sections list the areas in which you may need to make modifications to an RM/COBOL source program before you use it as input to Convert3.

8.3.1 The REDEFINES Clause

Convert3 cannot process data files whose definition includes a REDEFINES clause. If a record description in the File Section contains a REDEFINES clause, you must divide this record description into separate record descriptions.

You must also make sure that each record type in a file with multiple record types is identifiable by either:

See the section Record Type Specification in the chapter Running Convert3 for more information about handling multiple record files.

8.3.2 The USAGE IS INDEX Clause

Convert3 cannot process items with USAGE IS INDEX in a record description. If a record description contains such an item, you can alter the item to have a picture-string of S9(4) COMP-1.

8.3.3 The USAGE Clause with Group Items

Convert3 cannot process group items with a USAGE clause at the group level. To overcome this, add a USAGE clause to each elementary item in the group.

8.3.4 Continuation Columns

Convert3 cannot process source program statements with a continuation marker in column 7. This limitation applies only from the beginning of your source program to the end of the file section. To overcome it alter the layout of your source program so that it does not require continuation markers.

8.3.5 The DECIMAL POINT IS COMMA Clause

Convert3 cannot process the DECIMAL POINT IS COMMA clause in the SPECIAL-NAMES paragraph. To overcome this limitation remove the DECIMAL POINT IS COMMA clause.

8.3.6 Uniqueness of Names in Record Descriptions

All data-names in record descriptions must be unique. Therefore, you must remove all qualified data-names from record descriptions in the RM/COBOL source program.

8.3.7 DEPENDING Names

If a record description contains a DEPENDING phrase, the data-name in the DEPENDING phrase must occur in the same record.

8.3.8 Picture-strings

The maximum length of a picture-string in a record description is 20 characters. However, you can overcome this limitation by splitting any picture-strings which exceed this limit into two, and defining a FILLER item with a picture-string which corresponds to the size of the second half of the original string.


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