Previous Topic Next topic Print topic


Create a Structure File

You can create a structure file 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.

The datavseq.dat data file contains three types of record: employee, manager, and executive. You need to create a structure file that has 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 Data File Tools (Technology Preview) window, click File > New.
  2. Select Structure File, then click OK.

    The Select an .idy file dialog box appears.

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

    A new Structure tab is displayed in the Data File Tools (Technology Preview) window, containing the Data Division of dfdstaff.cbl in the Available Layouts pane, and the Selected Layouts pane on the right-hand side, where your layout(s) will be displayed.

  4. From the Available Layouts pane, right-click 01 EMPLOYEE-REC and select New Default Layout.

    The EMPLOYEE-REC layout appears in the Selected Layouts pane.

    This is the layout that a record will be displayed using if there are no other layouts, or no other layouts that have criteria that matches with the record.

  5. Right-click 01 MANAGER-REC in the Available Layouts pane, then select New Conditional Layout.

    The MANAGER-REC layout appears in the Selected Layouts pane.

    Note: You can differentiate the layouts by the icons (Default) and (Conditional).
  6. In the Selected Layouts pane, expand MANAGER-REC > MN-CODE.
  7. Right-click 05 MN-POSITION and select Add Condition.

    The Edit Condition dialog box appears.

  8. From the Condition section, in the Comparison field, select =.
  9. In the Value field, type M (upper case), then click OK.

    This M indicates a Manager record type.

  10. Repeat steps 5 through 9 to create a conditional layout for the Executive record type; substituting equivalent structures for EXECUTIVE-REC and using E to indicate the record type.

  11. On the File menu, select Save.

    The Save Layouts to File dialog box appears.

  12. Navigate to the location of datavseq.dat, then in the Filename field, enter datavseq.dfs and click Save.
Previous Topic Next topic Print topic