Creating templates for positional flat files

I am trying to convert a flat file to XML template to Record structure by following the directions in the EDI Adapter User’s Guide. I have a positional flat file with SEGMENT ID combinations more than I would like to code for. In addition, I have one trailer at the end of the flat file with a SEGMENT ID of ‘T’. The trailer record contains a total record count of the flat file. All I care to do is to count the actual number of records (excluding the trailer) in the flat file and extract the count value of the trailer record and compare the two values. I am using “recordsWithNoID” as the SEGMENT ID for counting of the flat file records because there are too many SEGMENT IDs to account for (plus I don’t know all of them). The other SEGEMENT ID is ‘T’ for the trailer. When I run my service, the ‘T’ SEGMENT ID returns a value, but the “recordsWithNoID” is not recognized, nor created and probably under udDefData. When I change “recordsWithNoID” to a SEGMENT ID that I know exists, then I get values from the flat file in my record structure. The only segment that I care to describe is the ‘T’ segment because I am pulling a value out of it. I am accounting for everything in the record reference.

An example is something like this:

(flat file)


(Flow Service)

map (pass in flat file)

I really want to use the flow services for this solution, but not tied to it. I am ready to write a java service if I have to. Any suggestions would be helpful.

Thanks, Robby

Are you using a template? If so could we take a look at it?

This is the template I am using. I am not describing the details for SEGMENT ID ‘recordsWithNoID’ because I don’t need the details for anything. I just care to count how many instances of ‘recordsWithNoID’ For SEGMENT ID ‘T’, I am extracting a value for Records starting at position 13.


This is my template

<?xml version="1.0"?>


<POSITION NAME="Records" START="13" LENGTH="5"/>