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.
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.
iWayHome\tools\transformer\samples\transform_projects\fwf\FWF_to_EDI_X12\FWF_TO_EDI_X12.gxp
where:
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.
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.
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.
In the following image, the generation of the invoice is in progress.
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 |