contents.gifindex.gifprev1.gifnext1.gif

6.1.7 Converting RM/COBOL Data Files

Data files written by RM/COBOL programs can be converted for use by ACUCOBOL-GT programs. The exact procedure depends on the version of RM/COBOL used to create the data files.

Sequential and relative files created by RM/COBOL version 2 programs are directly usable by ACUCOBOL-GT programs. These files have exactly the same internal format. (Note, however that this is not true for variable-length binary sequential files or variable-length relative files.)

RM/COBOL version 2 produces two types of indexed files: single-file format and dual-file format. The dual-file format consists of two physical files for each logical file. One of these files is a binary sequential file that contains the raw data records. The other is a file that contains the key information. You can convert one of these files by using the "load" option of vutil (described in the Debugger and Utilities chapter). To do this, first create an empty ACUCOBOL-GT indexed file either with a COBOL program (by doing an OPEN OUTPUT) or with the "generate" option of vutil. Then use the "load" option of vutil, specifying the RM/COBOL data file as the input file. Note that the RM/COBOL key file is not used.

A single-file format indexed file must first have its records unloaded into a binary sequential file with an RM/COBOL program. Then this file can be loaded into an ACUCOBOL-GT indexed file with the procedure described for the dual-file format.

Line sequential and fixed-length binary sequential files created by RM/COBOL-85 are directly usable by ACUCOBOL-GT. Use the following procedures to convert other RM/COBOL-85 formats to fixed-length binary sequential.

Converting relative files with variable-length records:

You can write a program in RM/COBOL-85 to convert variable-length relative files to fixed-length binary sequential files that ACUCOBOL-GT can use. To do this:

1. Write a program that reads the desired file using a DEPENDING ON phrase in the RECORD clause of the input file's FD. The variable depend will be filled in with the record size.

2. Define the output file as follows:

gt490000.gif Records should be fixed-length binary sequential.

gt490000.gif Each record must begin with two bytes that are COMP-4, and those two bytes should be filled in with the value of depend.

gt490000.gif The remainder of the record should be the actual record contents from the input file.

3. Write the output records to a new file. Use this new fixed-length binary sequential as your ACUCOBOL-GT data file.


Note that ACUCOBOL-GT binary sequential and relative files have essentially the same format.

Converting binary sequential files with variable-length records:

To convert binary sequential files with variable-length records, follow the same procedure (steps 1-3 above) used for variable-length relative files.

Converting relative files with fixed-length records:

To convert relative files with fixed-length records, write an RM/COBOL program that reads the file and writes the records to a fixed-length binary sequential file. The resulting relative file is usable by ACUCOBOL-GT.

Converting indexed files:

You can convert RM/COBOL-85 indexed files into ACUCOBOL-GT indexed files using the "convert" option of vutil. The procedure is fully described in section 3.3.10, "Converting RM/COBOL-85 Indexed Files."