Create a Record Layout

You can create record layouts from the Data Division of a COBOL program that uses the data file. By using the .idy file from the compiled program, you can display the records in a structured way, where the fields are formatted to their intended size. Layouts are stored in structure (.str) files.

The datavseq.dat data file contains three types of record: employee, manager, and executive. You can create a layout for each type of record, and then set criteria for when a particular layout is used. Of the three layouts, you define one as the default; all others are defined as conditional.

  1. From the Micro Focus Data File Tools window, click File > New > Structure File.

    The Open dialog box appears.

  2. Navigate to the dfdstaff.idy file (located in the output path of the DataToolsDemo project ), then click Open.

    A Layout window appears, containing the Data Division of dfdstaff.cbl.

  3. From the left-hand pane, right-click 01 EMPLOYEE-REC from the FD MF-File Section, then select Create Default Layout.

    The default layout is displayed in the Selected Layouts pane.

  4. In the left-hand pane again, right-click 01 MANAGER-REC, then select Create Conditional Layout.

    The new conditional layout appears in the Selected Layouts pane.

    Note: You can differentiate the layouts by the icons (Default) and (Conditional).
  5. In the Selected Layouts pane, expand 01 MANAGER-REC > MN-CODE, then right-click 03 MN-POSITION and select Properties.

    The Field Properties dialog box appears.

  6. From the Condition section, select Set Condition to enable the condition properties.
  7. From the Condition section, select =.
  8. In the middle field, type M (upper case), then click OK.

    This M indicates a Manager record type.

  9. Repeat from step 5 to create a conditional layout for the Executive record type; substituting the previous structures for 01 EXECUTIVE-REC, EX-CODE, and 03 EX-POSITION, and using E to indicate the record type.
  10. On the File menu, select Save As....

    The Save As dialog box appears.

  11. Navigate to the location of datavseq.dat, then in the File name field, enter datavseq.str and click Save.

    The structure file containing three layouts is now created, which means you can now view the corresponding data file formatted.