| Join wMUsers | Blog at wMUsers | User Control Panel | Site Map | webMethods Jobs |For Employers |
![]() | ![]() |
![]() |
IntroductionOne of the more difficult WmEDI Module tasks is creating parsing templates. This article provides a way for you to generate positional ("POS") parsing templates quickly and easily. I developed this code sometime ago to speed up the development process without cutting corners. On the last project, I saved several hours that I would have normally spent creating the templates. With the data file definitions available, you, too, will be able to save a significant amount of time. NOTE: This article assumes you are using Integration Server v4.6, and WmEDI Module v4.6 with all fixes and patches applied. Flat File PrerequisitesBefore I delve into the meat of this article, you must have the following elements present to parse a flat file:
When you have both elements, call the WmEDI package's Flow wm.b2b.edi.convertToValues. It will return an EDIValues object. This EDIValues object will be used to map the flat file data to your IData record. RmUtils PackageThe package provides the "Template Designer" interface that contains all of the code required to generate POS templates for your project. The package RmUtils contains two interfaces:
The package code is well-commented, but all of the Flows, Records and utilities are detailed in PDF-format. See the /pub directory of the package. Introduction to Positional "POS" flat filesFor the uninitiated, EDI files are often positional flat files. For the purpose of our project, we will use a positional contact record. This record can be found in the package /pub directory and is named SamplePositionalRecord.pdf. HDR001 REC001Contact Record NAM001Ray Moser DAT001Zettaworks LLC Principal Consultant ADD0012 Park Street Level 38 ADD002Sydney NSW 2000 AU EMAIL1rmoser@zettaworks.com NTE001I lead the webMethods discipline for Zettaworks. REC001Contact Record NAM001Robert Moser DAT001Zettaworks LLC Sr. EAI Architect ADD0015295 Hollister 2nd Floor ADD002Houston Texas 77040 US EMAIL1robert@zettaworks.com NTE001Robert is a genius and is adapt at webMethods. TRL001 The file at first glance looks difficult and unappealing. You’re probably thinking: "XML never looked so good!" Let’s examine the ADD002 line:
ADD002Sydney NSW 2000 AU To fully understand this line, you will need the data mapping for this segment:
The first field in this segment is the SegmentID. This is the unique identifier for the address2 segment. The value is ADD002. It starts at position 0 and has a length of 6. The second field in segment ADD002 is City. It starts at position 6 and has a length of 20. The index is base zero. The information in the ADD002 chart is required by the WmEDI parser and is contained in the segment ID descriptions in the template. Each segment in this file is fully explained in file PositionalDataDictionaryChart.pdf. A Positional Flat File is a data structure that is defined by segments. Each segment is generally a record or a set of fields. More complex POS files may contain multiple segments within a record. Segments are separated by a segment delimiter and contain n number of characters. Segments usually will not contain identical number of characters since the data contained in each is different. Now, with the understanding of the positional file, we will carefully examine the positional template. Go Deeper on the Subject: The wMUsers Discussion Forums Ray Moser is a a Principal Consultant with Zettaworks LLC, Houston, Texas and is working in Sydney, Australia on various webMethods projects. He has over 10 years experience in application architecture and development. He has architected and built several successful integration projects using the webMethods Integration server, Trading Networks and Enterprise Broker.
Ray can be reached at | ||||||||||||||||||||||||||||||||||||||||
| © All Rights Reserved, 2001-2008. |