Using the RecordEditor with Cobol

  • Main Record Editor
  • Importing Cobol Copybooks
  • Editing the File
  • Cobol Editor
  • Options
  • Compare Function
  • Compare Input / Output Cobol Program
  • Regression Testing
  • Online Testing
  • Copy function

  • Using the RecordEditor with Cobol

    The RecordEditor can edit Cobol Data files in 2 ways

    1. Via the main Editor. Cobol copybooks need to be imported into its Databases
    2. Using the "Cobol Editor". This editor works directly off a Cobol Copybook but is slightly less capable than the main editor (particular for files with multiple record layouts).

    As well as editing files, The RecordEditor can also


    Main Record Editor

    Importing Cobol Copybooks

    The first step in editing a file is to import the Cobol Copybook. To do this select Record Layouts >>> Load Cobol Copybook from the main menu


    The next screen to be displayed includes:


    ">

    Field

    Description

    Cobol Copybook

    Split Copybook

    How the copybook should be divided up (No Split - one record in the file; on redefine - Split into separate record on a Redefine Statement; on 01 - split into separate records for each 01 level).

    Font Name

    Blank for native files. Normally left blank for PC files; For mainframe EBCDIC use cp037.

    Binary Format

    Indicates the format of Numeric fields (in particular Comp* Cobol Fields). The Values to use



    Cobol Implementation Value

    IBM Mainframe Cobol Mainframe

    .Fujitsu PC Cobol Fujitsu

    Open Cobol (Default, 85 2002) Open Cobol

    Open Cobol (bs2000) Open Cobol bs2000

    Open Cobol MVS (with Ascii Character set) Open Cobol MVS

    Open Cobol Micro Focus Open Cobol Micro Focus

    Micro Focus Cobol Open Cobol Micro Focus

    File Structure

    Fixed Length Binary For files with multiple records:


    Cobol Implementation VB Structure

    Fujitsu PC Cobol Fujitsu Variable Binary

    Open Cobol (all versions) Open Cobol VB

    System.

    Basically a way of grouping Copybooks together in to logical systems.

    If you use the Split on Redefine or the Split on 01 to split the copybook into multiple records, the system will display the Record Definition screen. On this screen you can define the criteria for when to use each record using the Field and Field Value fields or if more complicated criteria are required, use the buttons to the right.

    Note: When a Cobol Copybook is loaded the RecordEditor sets a Cobol Copybook field to the Copybook name. When you reload a Cobol-Copybook, the RecordEditor will delete any copybook where the Cobol Copybook field is the same as the copybook being loaded !!!.

    Editing the File

    Once the copybook is loaded, it is then a matter of selecting the file and Selecting your Copybook in the RecordLayout Field.

    Note: You can use the system combo to limit Record-Layouts to a single System.


    Cobol Editor

    The Cobol Editor (shell script runEditorFileCopybook.sh) started life as specifically using Cobol Copybooks. These days its supports Cobol Copbooks, 2 XML layout formats, 2 csv layout formats. The primary screen looks like:


    ">

    Field

    Description

    File

    File to be edited

    File Structure

    For files with a single record length use Fixed Length Binary For files with multiple records:



    Cobol Implementation VB Structure

    Fujitsu PC Cobol Fujitsu Variable Binary

    Open Cobol (all versions) Open Cobol VB

    Copybook Type

    Format of the Record Layout. Use Cobol Copybook for Cobol Copybooks

    Split Copybook

    How the copybook should be divided up (No Split - one record in the file; on redefine - Split into separate record on a Redefine Statement; on 01 - split into separate records for each 01 level).

    Copybook

    Cobol copybook (or Record Layout description file)

    Numeric Format

    Indicates the format of Numeric fields (in particular Comp* Cobol Fields). The Values to use



    Cobol Implementation Value

    IBM Mainframe Cobol Mainframe

    Fujitsu PC Cobol Fujitsu

    Open Cobol (Default, 85 2002) Open Cobol

    Open Cobol (bs2000) Open Cobol bs2000

    Open Cobol MVS (with Ascii Character set) Open Cobol MVS

    Open Cobol Micro Focus Open Cobol Micro Focus

    Micro Focus Cobol Open Cobol Micro Focus

    Note: Same as field as Binary format in the "Importing Cobol Copybooks" screen.


    Options

    There are some options that can be set to make the RecordEditor easier to use with Cobol Copybooks / files. To make these changes


    Compare Function

    The compare function will compare Selected fields from 2 files (either the same Copybook or different copybooks) and display the results in a formatted way. The Compare utility essentially does field to field compare, this allow you to compare comp fields with either comp-3 or zoned decimal fields.

    Compare Table View:

    Single record view:

    Compare Input / Output Cobol Program

    One use for the RecordEditor's compare function is the standard Cobol Input / Output program.

          Input File   ---->   Cobol-Program   ---->   Output File
     
    


    Inbput Copybook Output Copybook

    3        01  In-File.
    4            03 In-Field-1            Pic X(5).
    5            03 In-Field-2            Pic s9(5) comp-3.
    6            03 In-Field-3            Pic X(5).
    

    3        01  Out-File.
    4            03 Out-Field-1           Pic X(5).
    5            03 Out-Field-2           Pic --,--9.
    6            03 Out-Field-3           Pic X(5).
    7            03 Out-Field-4           Pic 9999/Z9/Z9.
    8            03 Out-Field-5           Pic X(8).
    

    With the RecordEditor Compare you can still compare the 2 files even though they have different number fields and fields are a different format (e.g. In-Filed-2 / Out-Field-2).

    Regression Testing

    The compare function can be used to compare the output from the program (prior to change) with the output from the updated program. The field's that have changed will be highlighted in Green. In this case only Out-Field-5 changes.

    A less obvious use is to exclude the fields that are expected to change (in this case Out-Field-5):

    You can now do very large runs (100,000+ records) and compare the result, there should be no difference (Since field-5 is not compared). This is a good check that you have not changed something inadvertently.


    Online Testing

    A less obvious use for the RecordEditor is on-line testing. If you seperate front-end screen handling from the backend-Business logic, you can use the RecordEditor to setup and check the results.

    In Mainframe-Cics I have worked with systems where the front-end program only does Screen handling with all business logic done in backend programs:

       Front-End Program -- Call --> Backend Program
     
    

    To Test the Backend we used a driver program like:

        Read Screen-Record
        while not end-of-file
           Call Backend-Programs Screen-Record Response-Record
     
           Move Screen-Record      to Output-Input-Details
           Move Response-Record    to Output-Response-Details
           write output-Details
        end-while
     
    

    The Screen-Records where written / maintained with File-Aid and results where checked with File-Aid / Compare utilites.

    You can setup / maintain standard scripts and is generally very reliable. It works well when you have complicated business logic.


    Copy function

    The copy function is still being developed (and will have a few problems). It can be reached from the RecordEditor File Menu (File >>> File Copy Menu). Currently there are 2 functions

    1. Copy from one Record Layout to another. Either Layout could be Cobol or RecordEditor-Xml.
    2. Cobol Copy - Copies from one dialect of Cobol to another via a Cobol Copybook