17 Format Tester

This chapter provides a user interface reference for the Format Builder format tester.

Once you have build a format definition, you can test it using Format Tester. Format Tester parses and reformats data as a validation test and generates sample non-XML or XML data. This sample data can be edited, searched, and debugged to product the expected results.

17.1 Format Tester Window

The following topics discuss the elements of the Format Tester main window and provide instructions for navigating and executing commands from the Format Tester main window.

17.2 Format Tester Menus

The following menus are available in Format Tester. All Format Tester menus are expandable from your keyboard by pressing Alt +underlined letter. Some menu commands are also executable using Ctrl + letter keystrokes.

17.3 File Menu

The following commands are available from the File menu.

Table 17-1 File Menu Commands

Menu Command Description

Open Non-XML

Allows you to select a non-XML file to be displayed in the Non-XML window.

Note: The default file extension for non-XML files is .DATA.

Open XML

Allows you to select a file to be displayed in the XML section of the Format Tester window.

Note: The default file extension for XML files is .XML.

Save Non-XML

Allows you to save the contents of the Non-XML window.

Save XML

Allows you to save the contents of the XML window.

Debug Log

Allows the debug information to be saved in a text file.

Close

Closes the Format Tester window.


17.4 Edit Menu

The following commands are available from the Edit menu.

Table 17-2 Edit Menu Commands

Menu Command Description

Cut

Removes the currently selected text and places it on the clipboard for pasting into another location.

Copy

Copies the currently selected text and places it on the clipboard for pasting into another location.

Paste

Inserts the cut or copied text at the cursor location.

Find

Allows you to search for a hex or text value in the non-XML data.

Find Next

Continues your search to the next instance of the specified value.

Go To

Allows you to move the cursor in the Non-XML editor to a specified byte offset.


17.5 Display Menu

The following commands are available from the Display menu.

Table 17-3 Display Menu Commands

Menu Command Description

XML

Allows the XML data panel to be hidden or shown. If hidden, the non-XML data window expands to fill the width of the tester. The To XML button remains, but the splitter disappears.

Debug

Allows the Debug output window to be hidden or shown.

Clear > Non-XML

Resets the contents of the Non-XML data window to be empty.

Clear > XML

Resets the contents of the XML window to be empty.

Clear > Debug

Resets the contents of the debug window to be empty.

Hex > Offsets as Hexadecimal

Displays the offset values as hexadecimal. Selecting this option turns off the Offsets as Decimal display.

Hex > Offsets as Decimal

Displays the offset values as decimal. Selecting this option turns off the Offset as Hexadecimal display.


17.6 Generate Menu

The following commands are available from the Generate menu.

Table 17-4 Generate Menu Commands

Menu Command Description

Non-XML

Generates non-XML data to match the current format specification.

XML

Generates XML data to match the current format specification.

Prompt while generating data

If selected, you are prompted during the generation process to determine if optional fields or groups should be generated, determine which choice of children should be generated, and determine how many times a repeating group should repeat.


17.7 Transform Menu

The following commands are available from the Transform menu.

Table 17-5 Translate Menu Command

Menu Command Description

Non-XML to XML

Converts the contents of the Non-XML window to XML.

XML to Non-XML

Converts the contents of the XML window to non-XML data.


17.8 Shortcut Menu

Instead of using the standard menus to find the command you need, use the right mouse button to click an item in the pop-up shortcut menu.

The following commands are available from the Shortcut menu.

Note:

Some commands may be unavailable, depending on which display panel currently contains the mouse pointer.

Table 17-6 Shortcut Menu Commands

Menu Command Description

Cut

Removes the currently selected text and places it on the clipboard for pasting into another location.

Copy

Copies the currently selected text and places it on the clipboard for pasting into another location.

Paste

Inserts the cut or copied text at the cursor location.

Clear

Resets the contents of the Non-XML or XML window to be empty.

Generate

Generates Non-XML or XML data to match the current format specification.

To XML

Converts the contents of the Non-XML window to XML.

To Non-XML

Converts the contents of the XML window to non-XML data.


17.9 Using the Non-XML Window

The Non-XML data display panel acts as a hexadecimal editor or a text editor, depending on which tab is selected.

The hexadecimal editor panel displays data offsets, the hex value of individual bytes, and the corresponding text. The corresponding text can be optionally displayed as ASCII or EBCDIC characters. The editor allows for editing of the hex byte or the text value. If a hex data value is modified, the corresponding text value is updated, and vice versa.

See Also

17.10 Using the Data Offset Feature

The data offset feature of the hexadecimal editor lets you display your data offsets as Hexadecimal or Decimal.

To change your data offsets:

Choose Display > Hex. The following two data offset options display.

  • Offsets as Hexadecimal

  • Offsets as Decimal

Click the display option that best suits your needs. The data offset panel of the Non-XML window dynamically changes to reflect your choice.

17.11 Using the Text Feature

To use the Text feature, select the Text tab from within the Non-XML window to view all printable characters, such as carriage returns. The Text window shows these as text with line breaks.

17.12 Using the XML Window

The XML data panel displays XML data that has been converted or transformed from the contents of the Non-XML panel. The contents of the XML panel can be cleared or edited to suit your needs.

You can also use this window to enter or generate the XML data to be transformed into non-XML format.

17.13 Using the Debug Window

The Debug window displays the actions that take place during the transformation operation, any errors that are encountered, and field and group values and delimiters. To determine the location of the error, determine the last field that parsed successfully and examine the specification of the next field on the Section 9.3, "Using the Tree Pane" of Format Builder.

When you open the Format Tester, only the Non-XML and XML windows are visible. To open the Debug window, choose Display > Debug to toggle the Debug window on and off. The Debug window opens below the Non-XML and XML windows.

Note:

Debug output is restricted to the most recent 64 KB of messages. Full debug information can be captured to a file. See Section 17.18, "Using the Debug Log" for more information.

17.14 Using the Resize Bars

Resize bars are located between the Non-XML, XML, and Debug windows. These resize bars enable each window to be resized to suit your needs. Each resize bar can be selected and dragged up and down, or left and right, as appropriate, to enlarge one of the windows and reduce the other.

Each resize bar also contains two directional buttons that can be clicked to enlarge or diminish any of the three windows.

17.15 Debugging Format Definitions

The following topics discuss the various Format Tester utilities you can use to debug and correct your data.

17.16 Searching for Values

The Find feature lets you search for hex or text values in the Non-XML data. The following fields are available from the Find dialog.

Table 17-7 Find Options

Field Description

Value

Enter the value you want to find.

Text

Select this option to find a text value.

Hex

Select this option to find a hex value.

Forwards

Select this option to search from the selected location to the end of the document.

Backwards

Select this option to search from the selected location to the beginning of the document.

Beginning of File

Select this option to start the search at the beginning of the file.

Current Position

Select this option to start the search at the current cursor location.

End of File

Select the option to start the search at the end of the file.

OK Button

Begins the search operation.

Cancel Button

Closes the Find dialog without performing a search.


17.17 Searching for Offsets

The Goto feature lets you move the cursor in the Non-XML editor to a byte offset you specify. The following fields are available from the Goto dialog.

Table 17-8 Goto Options

Field Description

Offset

Enter the offset value you want to find.

Dec

Select this option to go to a decimal value.

Hex

Select this option to go to a hex value.

Forwards

Select this option to search from the selected location to the end of the document.

Backwards

Select this option to search from the selected location to the beginning of the document.

Beginning of File

Select this option to start the search at the beginning of the file.

Current Position

Select this option to start the search at the current cursor location.

End of File

Select the option to start the search at the end of the file.

OK Button

Begins the search operation.

Cancel Button

Closes the Goto dialog without performing a search.


17.18 Using the Debug Log

The debug log lets you save your debug information to a text file.

To use the debug log, choose File > Debug Log. A dialog displays allowing you to enter a new path and file name or choose an existing file in which to save the debug information.

Note:

If you select an existing file, the new debug information is appended to the end of the file.