Example: Transforming a Fixed-Width Message Into an EDI-Formatted Message

How to:

Electronic Data Interchange (EDI) refers to the standards for the exchange of information between organizations through the use of computers. Consider a business case in which you receive a shipment notification message in proprietary form, as a text file containing records of fixed width. You need to generate a customized EDI-formatted message, such as a product invoice, in response to each proprietary shipment notification message.

Supplied with your product during installation is a sample set of files for transforming fixed-width format to EDI format. It is an efficient solution for the business case described here and for similar business cases. You will implement the solution using iWay Transformer and Dictionary Builder.


Top of page

x
Procedure: How to Transform a Fixed-Width Message Into an EDI-Formatted Message
  1. From the iWay Transformer installation folder, navigate to samples\transform_projects\fwf\FWF_to_EDI_X12.
  2. Using a text editor such as WordPad, open the file named shipment.TXT, as shown in the following image.

    shipment.txt file

    Lines 2, 3, and 4 start with a two-digit number. The other lines also start with a number. Since all lines start with a number, each line can be recognized by its first two-digit characters. The document can be organized into six record types: 10, 11, 20, 30, 60, and 99. The first two digits of a record represent the record type.

    You can also recognize header and footer records, starting with 10 and 99, respectively. Three records containing the address of the shipment parties immediately follow the header record. Those records start with 11, 20, and 30, respectively.

    The rest of the records have the same type, 60. They contain the shipment items.

    In this example, you need to describe six different types of records. You can accomplish that using the Fixed-Width Dictionary feature and Dictionary Builder.

    The following image shows the fixed-width message.

    Fixed-width message

  3. From the iWay Transformer File menu, click Open and From File.
  4. Select the Transform project at the following location
    iWayHome\tools\transformer\samples\transform_projects\fwf\FWF_to_EDI_X12\FWF_TO_EDI_X12.gxp

    where:

    iWayHome
    Is the directory in which iWay Service Manager is installed.
  5. Under the project name in Project Navigator, expand the Input and Dictionary folders.
  6. Click Structure to display the Fixed-Width Dictionary in the Dictionary Builder workspace, as shown in the following image.

    Displaying Fixed-Width Dictionary in Dictionary Builder workspace

    In the TransformCDFlayout dictionary root, there are seven group branches, called RecordDetails, that are children of the root. Each branch corresponds to one of the distinct record types identified in step 2.

  7. Expand each RecordDetails branch to display its contents, as shown in the following image.

    Expanding a RecordDetails branch to display its contents

    Each RecordDetails branch defines a particular record type. Each branch contains a Loop group, which in turn contains a record type segment. A record type segment is labeled with two unique initial digits. Those digits identify the record type, for example, 10, as shown in the preceding image.

    A record type segment contains leaf nodes, also called record columns or fields. Each leaf node, such as INVOICE_NUMBER in the preceding image, has a field name and offset fields. INVOICE_NUMBER is the first field in this record. Its StartOffset is 3, because the first two digits of the record are defined in the record type parent segment, which in this case is segment 10.

  8. To display the properties of a selected node, right-click the node and click Properties, as shown in the following image.

    Selecting the Properties option for a node

    The following image shows the Component Node Properties dialog box that is displayed for the selected record type segment. The Name, Type, StartOffset, and Length fields indicate that this record type starts at the first digit and is two digits long.

    Component Node properties dialog box for a selected node

  9. Navigate to the Output structure of the dictionary to confirm that this is a standard EDI invoice, as shown in the following image.

    Standard EDI invoice in Output structure

  10. Switch back to the Mappings tab, expand the Loop0 group, and expand its _10 branch on the Input. Also expand the EDI/Group_Loop/880/GO1 branch on the Output to display the mappings, as shown in the following image.

    Sample mappings

  11. Click the Test Transform tab to view the generation of the EDI shipment invoice, according to the structure and mappings defined in this Transform project.

    In the following image, the generation of the invoice is in progress.

    Generating an EDI shipment invoice

    It is possible to manually edit the XML structure of the dictionary as coded in the XML file. However, it is easier to use Dictionary Builder. With manual editing, you must know XML and be familiar with fixed-width components.


iWay Software