PreviousConverting RM/COBOL Data Files Using the File Conversion ProgramNext"

Chapter 9: Running Convert3

The first step in converting your RM/COBOL data files is to use the Convert3 utility to produce a file conversion program. You must input to Convert3 the RM/COBOL source program that created the data files you are converting. When you have created a file conversion program, you can use it to read RM/COBOL data files and convert them to the format used by this system.

You can use Convert3 in either of two modes: interactive or batch mode.

If you run Convert3 in interactive mode, prompts are output to your screen for you to enter the various parameters that control the production of the file conversion program.

If you run Convert3 in batch mode, you must supply the necessary control parameters in a file.

9.1 Running Convert3 in Interactive Mode

The Convert3 utility is entirely menu-driven when run in the interactive mode. It has an on-line help facility on each menu, which you can access by pressing the key configured as the help key on your machine. This displays a screen of information on the facilities available on each menu.

To invoke Convert3 enter the command:

convert3

Once you have invoked Convert3 the main menu is displayed. From this menu you can select any of the following functions:

To select the function of your choice, press the associated function or character key, as indicated in the menu.

The following sections describe these functions.

9.1.1 Help

This function is available to you when the main menu is displayed, and when you select either the File Details function, the Printfile Name function or the Record Type Specification function.

When you select this function, a help screen is displayed for either the main menu or the function you have selected.

9.1.2 File Details

Selecting this function on the main menu displays a screen which prompts you to identify which data files produced by the RM/COBOL source program are to be converted.

Enter the following information on the screen:

  1. The FD name of the file to be converted, as it appears in the RM/COBOL source program.

  2. The name of the RM/COBOL source program which created the original data file.

  3. The name of the file conversion program which Convert3 is to generate. This name cannot be the same as that of the RM/COBOL source program.

  4. The setting of the RM directive. This can be either R for RM/COBOL, (which will cause ORGANIZATION SEQUENTIAL files to be treated as Line Sequential with SIGN SEPARATE) or A for RM/COBOL with the ANSI switch set (which will cause ORGANIZATION SEQUENTIAL files to be treated as Record Sequential with SIGN INCLUDE). If your program contains any Organization Sequential files with COMP-3 data, you must use A. See your Object COBOL User Guide for full details of the RM Compiler directive.

  5. The conversion of COMP-6 items to VS-COMP. This can be either Y, in which case behavior is as described in the section COMP-6/ COMPUTATIONAL-6 Data in the chapter Converting RM/COBOL Data Files, or N, in which case COMP-6 items are not converted to VS-COMP. The default setting is Y.

Press Enter to enter the data on this screen and return to the main menu. If you specify an invalid parameter, the screen is redisplayed for you to re-enter a valid one.

Press Escape to return to the main menu without saving your entries.

9.1.3 Printfile Name

Selecting this function on the main menu displays a screen which prompts you to enter the name of a file to which Convert3 will write all status or error messages. If you choose not to enter this parameter, all messages are output to the screen.

9.1.4 Record Type Specification

Selecting this function on the main menu displays a screen which allows you to specify the information needed by Convert3 to process data files that contain more than one record type. That is, you can provide the information Convert3 requires for data files that have more than one 01 level entry in their File Descriptions. You can uniquely determine the type of each record in such multiple-record type files by entering one (and only one) of the following parameters:

Press Enter to enter the data on this screen and return to the main menu. If you specify an invalid parameter, the screen is redisplayed for you to re-enter a valid one.

Press Escape to return to the main menu without saving your entries.

9.1.4.1 Identifying Record Types by Subroutine

You can use a subroutine to determine each record type in a data file with multiple types of records. The file conversion program calls this subroutine each time it reads a record from the RM/COBOL data file. The program passes the contents of the record to the subroutine which must use some method to determine the type of record. The subroutine then returns a value to the file conversion program indicating the record type. This value is an index to the 01 level entries in the file's FD entry. For example, if a record corresponds to the first 01 level entry in the FD, the subroutine should return the value 1. If a record corresponds to the third 01 level entry in the FD, the subroutine should return the value 3.

The format of the CALL statement in the file conversion program is:

call "name" using record-name,
                  record-number,
                  record-length

where the parameters are:

name The subroutine-name that you have supplied on this screen.
record-name An alphanumeric data item referring to the record that has just been read from the RM/COBOL data file.
record-number A PIC 99 field into which your subroutine will return the number identifying the record type.
record-length A PIC 9(6) COMP item containing the length of the record. This is supplied only if you are converting a binary sequential file.

Example:

Below is an example of a subroutine that you could write to identify a type of record.

 linkage section.
 01 record-name. 
     03 filler           pic x(6). 
     03 rec-id-field     pic 9(6). 
 01 record-type           pic 99. 
 01 record-length         pic 9(6) COMP. 
 procedure division using record-name,record-type,record-length. 
 main-para.
     if rec-id-field < 10
         move 1 to record-type
     else
         if rec-id-field > 9 and < 80
             move 2 to record-type
         else
             move 3 to record-type
         end-if
     end-if
     exit program. 

9.1.4.2 Identifying Record Types by Unique Record Item

The file conversion program may be able to determine a type of record in a file with multiple types of records by examining the value of a particular data item. However, it can do this only if this value uniquely determines the record type.

If this is true, enter the name of the record item on this screen as it appears in the FD entry in the RM/COBOL source program. Now you must enter a list of level 88 conditions and the record numbers that each of these conditions identify. The record number, as with the value returned by a subroutine, indexes the appropriate 01 level entry in
the FD.

For example, you might make the following entries on this screen:

Identifying Data Item OR User Subprogram Name 
[REC-TYPE-ITEM                    ] 
record                    value(s)
number
[1]         [1 thru 15                          ] 
[2]         [16                                 ] 
[3]         [17 19 21 24 thru 30                ] 
[4]         [18 20                              ] 
[5]         [22 23                              ] 
[6]         [OTHERWISE                          ] 
[ ]         [                                   ] 
[ ]         [                                   ] 
[ ]         [                                   ] 
[ ]         [                                   ] 

The sequence in which these entries appear is significant. See the section Example Parameter File later in this chapter.

If the identifying data item is nonnumeric, you must ensure that each value you enter is in quotation marks. For example, if REC-TYPE-ITEM in the above screen display is declared as PIC XX, you must make the following entries on the screen:

record                    value(s) 
number 
[1]         ["1" thru "15"                      ] 
[2]         ["16"                               ] 
[3]         ["17" "19" "21" "24" thru "30"      ] 
[4]         ["18" "20"                          ] 
[5]         ["22" "23"                          ] 
[6]         [OTHERWISE                          ] 
[ ]         [                                   ] 
[ ]         [                                   ] 
[ ]         [                                   ] 
[ ]         [                                   ] 

9.1.4.3 Binary Sequential Files

In a binary sequential file with multiple record types, the file conversion program can identify a record type by its length as long as no two record types have the same length. However, if they do, you will have to use either the subroutine or unique identifier method to identify the record type.

9.1.5 Generate Program

Selecting this function from the main menu generates the file conversion program. You must have previously supplied Convert3 with all of the necessary parameters to enable it to generate this program.

The message:

Creating Source 

is displayed while Convert3 generates the file conversion program.

If any errors occur during generation, relevant error messages are displayed on the screen. If you have specified the name of a printfile these messages are also written to that file.

When a file conversion program has been successfully generated you are returned to the main menu.

9.1.6 Escape

Leaves the Convert3 utility and returns you to your main system prompt. You are asked to confirm that this is what you want to do.

9.2 Running Convert3 in Batch Mode

You can run Convert3 in batch mode by placing all necessary control parameters in a parameter file and running Convert3 so that it reads parameters from this file rather than from the screen.

You can include parameters for several runs of Convert3 in the same parameter file. This means that you can write a single parameter file to convert all of your data files at once.

9.2.1 The Parameter File

The parameter file is a free format line sequential file. You can specify one parameter per line. You can leave blank lines in the parameter file to improve readability since they are ignored by Convert3. You can also insert comment lines in the parameter file by using an asterisk (*) as the first non-space character in the line.

The first word on each line of the parameter file identifies the type of parameter you are specifying. This can be any of the following (in upper- or lowercase characters):

COMP6-COMP
FD
IDENTIFIER
LISTFILE
PROGRAM
RUN
SIGN
SOURCEFILE
SUBROUTINE

In addition, a line may start with a record number followed by a valid 88-level condition.

9.2.1.1 The Listfile Parameter

The listfile parameter specifies the name of the file to which Convert3 will write any status and/or error messages. The parameter has the following format:

listfile file-name 

If you specify neither a listfile parameter nor a file-name after listfile, messages are written to the screen.

9.2.1.2 The Sourcefile Parameter

The mandatory sourcefile parameter specifies the name of the RM/COBOL source file containing the description of the data file to be converted. The parameter has the following format:

sourcefile file-name

9.2.1.3 The FD Parameter

The mandatory fd parameter specifies the name in the FD entry of the data file to be converted as it appears in the RM/COBOL source program. The parameter has the following format:

fd file-name 

9.2.1.4 The Program Parameter

The mandatory program parameter specifies the name of the file conversion program that Convert3 will generate. The parameter has the following format:

program program-name 

The program-name must not be the same name used in the sourcefile or listfile parameter.

9.2.1.5 The Subroutine Parameter

The subroutine parameter specifies the name of a subroutine that the file conversion program can call to determine a type of record in a file with more than one record type. The parameter has the following format:

subroutine program-name 

9.2.1.6 The Sign Parameter

The sign parameter specifies how the sign is represented in items with USAGE DISPLAY. The parameter has the following format:

If you don't supply a sign parameter, separate is assumed as the default.

9.2.1.7 The Identifier Parameter

The identifier parameter specifies the name of an item in the file record whose value can be used to uniquely determine a type of record in a file with more than one record type. The parameter has the following format:

identifier item-name

9.2.1.8 Record Number Parameters

If you have specified an identifier parameter, you must specify a number of parameters that indicate which values of the item named in the identifier parameter correspond to which record types. Each parameter has the following format:

record-number condition

where the parameters are:

record-number Indicates a record type (1 means the first 01 level entry in the FD, 2 means the second 01 level entry, and so on). Record identification is carried out in the order in which the record numbers are specified.
condition An 88-level record-type which, if true, indicates that the associated record-number gives the correct record type. The OTHERWISE condition indicates the correct record type for those values of the item named in the identifier parameter that you have not previously specified in the Record Number parameter.

You can specify these parameters in any order of record-number, but all record number parameters must immediately follow the identifier parameter.

See the section Example Parameter File later in this chapter for an example of the use of these parameters.

9.2.1.9 The Run Parameter

The run parameter invokes Convert3 with those parameters that already have been read. The parameter has the following format:

run 

It does not matter whether Convert3 has successfully generated a file conversion program for one set of parameters. Convert3 continues to read the next set until the next run parameter is encountered, at which point Convert3 again tries the program generation process. This cycle continues until all parameters in the parameter file have been read.

You must supply a run parameter.

9.2.1.10 The COMP6-COMP Parameter

The comp6-comp parameter allows you to specify whether or not to convert COMP-6 items to VS-COMP. The parameter has the following format:

comp6-comp [y/n]

where the parameters are:

y Gives behavior as described in the section COMP-6/ COMPUTATIONAL -6 Data in the chapter Converting RM/COBOL Data Files
n Means COMP-6 items are not converted to VS-COMP.

The default is y.

9.2.1.11 Example Parameter File

The following is an example of a parameter file that generates file conversion programs for three RM/COBOL data files.

************************************************** 
* Parameters for first run                       * 
************************************************** 
listfile history.lst 
sourcefile payroll1.cbl 
fd employee-file 
program progemp.cbl 
sign separate 
identifier employee-status 
2    99 103 200 201 
1    1 thru 2000 
3    6786 9999 
2    0 thru 9999 
4    otherwise run


************************************************** 
* parameters for second run                      * 
************************************************** 
sourcefile payroll2.cbl 
* listing will go to history.lst 
fd branch-file 
sign included 
program program.cbl 
subroutine branchek 
run

************************************************** 
* parameters for third run                       * 
************************************************** 
listfile logfile 
sourcefile payroll2.cbl 
fd history-file 
program history.abc 
sign included 
run 



    
    
    


Notes:


9.2.1.12 Running Convert3 with a Parameter File

To run Convert3 with a parameter file, enter the command:

convert3 parameter-filename 

Each set of parameters is validated by Convert3 before the file conversion program is generated. If any parameters are invalid, that particular file conversion program is not generated, and Convert3 passes to the next set of parameters in the parameter file.

You can validate the parameters in a parameter file by entering:

convert3 parameter-filename VALIDATE 

The contents of the parameter file are validated, but no file conversion programs are generated.


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

PreviousConverting RM/COBOL Data Files Using the File Conversion ProgramNext"