Reformatting a DG COBOL Source File | Running Convert5 |
This chapter describes the Convert5 utility, which you must use to be able to convert your DG Interactive COBOL data files to Micro Focus COBOL data file format. When you use the Convert5 utility, a file conversion program is produced, which itself can be used to convert your data files. See the chapter Using the File Conversion Program for details on using the file conversion program.
In order to run Convert5 you must supply it with the name of an existing DG Interactive COBOL source program (or COPY-file) that is syntactically correct. This source program must contain the FD and SELECT ... ASSIGN entries, together with any associated record definitions, for the DG Interactive COBOL data file which you want to convert. See the chapter Running Convert5 for details on running Convert5.
Convert5 can convert sequential, relative and indexed files from DG Interactive COBOL format to Micro Focus COBOL format. You do not need to convert line sequential files as these are already in a format which is compatible with this COBOL system's requirements.
Convert5 supports sequential files with either fixed or variable length records. The default record type has fixed length records. However, it will handle a sequential file with variable length records if the RECORDING MODE IS VARIABLE clause is included in the FD entry.
Before transferring relative files to this COBOL environment, you must reformat them. To do this, you must add a four-byte field containing each record's relative key, to the start of every record contained in the original data file. Figure 15-1 is an example of a program which performs this reformatting for a specified relative file. It must be run on your DG machine.
identification division. program-id. rel2seq. date-written. 10/22/85. * * this program converts a dg relative file to a * format suitable for subsequent conversion * for use with the Micro Focus system * environment division. configuration section. source-computer. dg-10. object-computer. dg-10. * input-output section. file-control.
select relative-file assign to disk "dgrelative" organization is relative access is sequential relative key is relative-key file status is file-stat.
select mf-file assign to disk "mfrelative" organization is sequential access is sequential file status is file-stat.
data division. file section. fd relative-file label records are omitted. 01 relative-rec pic x(20).
fd mf-file label records are omitted. 01 mf-rec. 03 mf-key pic 9(9) comp. 03 mf-data pic x(20).
working-storage section. 01 relative-key pic 9(4) comp value 0. 01 file-stat pic xx value "00". 01 relative-flag pic 9 value 0. 01 relative-cnt pic 9(9) value 0. 01 mf-cnt pic 9(9) value 0.
procedure division. main-procedure section. main-proc1. open input relative-file output mf-file. perform read-write until relative-flag = 1. display "relative records read = " relative-cnt. display "mf records written = " mf-cnt. close mf-file relative-file. stop run.
read-write section. read-write1. read relative-file at end move 1 to relative-flag go to read-write-exit. if file-stat not = "00" display "input file status = " file-stat stop run. add 1 to relative-cnt. add 1 to mf-cnt. move relative-key to mf-key. move relative-rec to mf-data. write mf-rec. if file-stat not = "00" display "output file status = " file-stat stop run.
read-write-exit. exit.
Figure 15-1. Relative File Reformatting
Once you have reformatted your data file, following the guidelines given in Figure 15-1, reform5 can read it sequentially and convert it to the relative format used by this system.
You must pass any indexed data files which you wish to convert to
Micro Focus COBOL format, through the DG Interactive COBOL utility REORG.
This enables Convert5 to read the data portion of the files sequentially.
It can then convert them to the indexed format used by this system.
The following types of DG data are supported by this COBOL environment:
You should note that Convert5 does not support the DG INDEX data format.
You should be aware of the following restrictions while using Convert5:
COPY "filename".
If you supply Convert5 with DG Interactive COBOL source code that is syntactically incorrect, it outputs an error message only if it detects the syntax error. It will then close any open files and abandon the conversion. However, Convert5 may not detect that the supplied code is invalid and may proceed to create a file conversion program. If you then run this program, it may convert data incorrectly. We thus strongly advise that you ensure that the code which you supply to Convert5 is syntactically valid.
We also advise that you supply Convert5 with a DG Interactive COBOL source program which writes rather than reads the data file which you wish to convert. This ensures that all of the necessary information concerning the data files can be found in the supplied source program.
Once you have supplied Convert5 with the necessary parameters (see the chapter Running Convert5 for details) it reads the specified source program, and searches for certain key-words. It then extracts the necessary information from the entries associated with these key-words.
The File-Control paragraph is the first entry for which Convert5 searches. This entry must be located in your main source file, and it must start in margin A. Once Convert5 has found this entry, it looks for the SELECT ... ASSIGN statement relating to the file or record which you wish to convert to Micro Focus COBOL format. This statement can be in the main source file, or in a COPY-file.
Having read and extracted the relevant information from the File-Control entry and the SELECT ... ASSIGN statement, Convert5 searches for the following key-words: FD, WORKING-STORAGE, LINKAGE and PROCEDURE. These words, together with their associated entries, can be contained either in the DG Interactive COBOL source file, or in a COPY-file.
Convert5 extracts the relevant information from all of the above statements, which enables it to create a file conversion program. This file conversion program is capable of loading a file in standard Micro Focus format which has the same organization as that quoted in the SELECT ... ASSIGN statement in the original DG Interactive COBOL source file.
If the description of the DG Interactive COBOL data file does not match its actual format, when you try to run the file conversion program it will report an appropriate error message and abort the current file conversion. In this situation you must provide a source file description that Convert5 is able to process.
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Reformatting a DG COBOL Source File | Running Convert5 |