PreviousReformatting a DG COBOL Source File Running Convert5Next"

Chapter 15: Converting DG COBOL Data Files

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.

15.1 Supported Data File Types

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.

15.1.1 Sequential Files

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.

15.1.2 Relative Files

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. 
     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. 
     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 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.

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.

15.1.3 Indexed Files

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.

15.2 DG Data Types

The following types of DG data are supported by this COBOL environment:

COMP This is identical to COMP in this COBOL system.
DISPLAY This format obeys the same rules as the DISPLAY format in this COBOL system, except that any processing signs are stored differently. Convert5 converts the DG format to the standard ASCII format. However, if you wish to emulate the DG behavior you can do so by manually amending your source code before you run Convert5. You must change the definition of these fields from signed numeric to alphanumeric. If you do this you must also set the SIGN"EBCDIC" parameter when you submit your code to this COBOL system.

You should note that Convert5 does not support the DG INDEX data format.

15.3 Source File Restrictions

You should be aware of the following restrictions while using Convert5:

  1. You must supply Convert5 with DG Interactive COBOL source code or COPY-files that are syntactically correct.

  2. You must make sure that no USAGE IS INDEX , REDEFINES or RENAMES clauses appear in the record descriptions contained in your source code. The interpretation of records that contain such clauses is ambiguous and thus Convert5 is unable to handle them. If your source code does contain record descriptions that use USAGE IS INDEX, REDEFINES or RENAMES, before using Convert5 you should first split such record descriptions into separate descriptions. Next, before you try to convert the relevant files, ensure that these records are identifiable, either by a record type field or via a subroutine. You must write such a subroutine yourself.

  3. You will normally need to define the record structure of multiple record files if Convert5 is to run successfully. See the chapter Running Convert5 for details.

  4. The Convert5 program does not interpret those statements in your source program which begin with a continuation mark in column 7 . Convert5 returns an error if it detects such a marker in an area of the source program which it needs to analyze.

  5. The time order of duplicate alternate keys in indexed files cannot be preserved when you convert such files.

  6. FD and SELECT ... ASSIGN entries can be contained in a COPY-file provided the COPY statement is of the form:
        COPY "filename". 

  7. Convert5 does not support any other form of the COPY statement.

  8. The USAGE clause is not supported for group level data-items.

  9. The phrase DECIMAL POINT IS COMMA is not supported by Convert5.

  10. As all data-names in a record definition must be unique, you cannot supply Convert5 with DG Interactive COBOL source code which includes qualifiers in a record.

  11. Convert5 assumes that any depending name occurs in the same record.

  12. No picture-string must be greater than 20 characters in length.

  13. Composite picture-strings must not contain numeric characters.

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.

15.4 The File Conversion Process

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.

PreviousReformatting a DG COBOL Source File Running Convert5Next"