Designing a Custom XFD

The File Designer XFD tab lets you add XFD directives to your FD to design an extended file descriptor (XFD) for your data files. XFD files are commonly used to map fields in a record to columns in a table. If you are using AcuXDBC, for example, or reading or writing XML data with AcuXML, XFD files help map the data for translation between file formats. AcuBench can also make use of one XFD directive, the NAME directive, to make some of its Screen Designer and Report Composer interfaces more readable.

Regardless of whether or not you have made changes to this tab, you can create an XFD file for any data file described in an AcuBench data layout file.

General information about XFDs can be found in File Processing.

To add XFD directives to your FD, do the following:

  1. Select an item in the Field Name list on the left side of the interface.

    The options available on the right side of the interface are enabled or disabled depending on your selection.

  2. If you have selected the FD statement, the File Directive field is enabled. Enter a base name from which the XFD name will be formed. The default name is based on the ASSIGN TO clause of the SELECT statement.
  3. If you have selected a field in your FD, several fields are enabled. Which fields are enabled depends on whether or not the selected field is a group item. Use the information immediately following this procedure to assign directives to data items.
  4. When you finish adding XFD directives, close the File Designer, then right-click the icon for your new DLT in the Data view and select Generate FD/SL from the pop-up menu. The information in your data layout file is now available to the programs in your project.

    To view the FD (including the XFD directives that you have specified), you can right-click the icon for your DLT in the Data view and select View dlt-name.fd.

  5. To generate an XFD, right-click the data layout icon and select Make XFD File. The XFD is generated into the directory containing your FD, SL, and DLT files.

Name Directive

XFD NAME directives can be used to assign a name to a field in a file. This is often used to add a descriptive, formatted, or shortened name to a field, in order to create a more readable table. You can also elect to have alternate names specified with the NAME directive appear in the AcuBench Drag and Drop, Make Radio Button, and Autoload interfaces used to create screen and report controls. These names are then also used as the default title or label associated with the control.

To define a new name for a field, enter the name in the Name Directive field.

If you want the name specified by the NAME directive to appear in AcuBench interfaces:

  1. Open the Tools > Options interface and select the Screen Designer category.
  2. Mark the Apply XFD Names to Drag & Drop check box.
  3. Select the Report Writer category and mark the Apply XFD Names to Drag & Drop check box.
  4. Click OK to save your changes.

By default, data items in the Drag and Drop interface are listed using the field names defined in the file description. For more information about the Drag and Drop interface, see Drawing Controls with Drag-and-Drop, which pertains to screen design, and Using Drag-and-Drop, which discusses report design.

Use Group Directive

The USE GROUP directive allows you to enter a group item into the XFD as a single field, instead of using the elements contained in the group. This field is only enabled if you have selected a group item.

You can use the USE GROUP directive in conjunction with the NAME directive to assign a single name for the entire group.

Data Type Directive

When you mark the Data Type Directive check box, you can specify a format for the data item other than that established by the PICTURE clause. This means that you can have a database treat a numeric data item as alphanumeric, for example, or have a date item stored as numeric appear in a formatted date format. Select one of the following formats:

  • Alpha indicates that the selected fields should be treated as alphanumeric.
  • Binary specifies that the data in the field could be alphanumeric data of any classification. Absolutely any data is allowed.
  • Date marks the selected data field or group as a date. Enter the date format in the entry field to the right of the Date radio button.
  • Numeric treats the selected data item as an unsigned integer.
  • Var-Length designates the data item as having a variable length.

When Directive

The WHEN directive is used when you want to include multiple record definitions or REDEFINES in the XFD file. When you mark the corresponding check box, a field is enabled, allowing you to enter WHEN directive syntax. Click the ellipsis button to display the Expression Builder dialog, where you can also construct WHEN directive syntax.

You can use the Table Name field to add an optional tablename clause to the WHEN directive. If you assign a table name, the data that immediately follows the WHEN directive and meets the specified condition will be considered as a separate table.

Comment Directive

You can use COMMENT directives to include comments in your XFD field. Mark the Comment Directive check box, then enter a comment in the associated entry field.