Fixed length Flat file problem

Hello All:
i am working for the first time with parsing flat files in Webmethod 4.6 version. I have defined the schema for the following example of a fixed length record.

H 0 04157 040102231821000004
Teresa Vacations 00000030056796666 Marshall
Techy Vacations 01092004200304891 Nielsen
T 04157

In this the fields in between the Header(H) record and Trailer (T) record are repeating. The schema i have define is:

<segmentid=“h”>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position> </segment>
<segmentid=“recordwithnoid”>
<position>
<position>
<position>
<position>
<position>
<position>
<position> </segment>
<segmentid=“t”>
<position>
<position>
<position>
<position> </segment>
<seg-id>H</seg-id>
<loop>
<seg-id>recordWithNoID,</seg-id>
</loop>
<seg-id>T</seg-id>

Everything works fine when the repeating field does not have data starting with H or T, like in the above example file…i get Teresa Vacations mixed up with the T of Trailer and output is not correct. I was able to hack this by adding in <segmentid="t> - a space like "T " for the Trailer segment id and same for Header, since these two will always be followed a empty space filler. This does correct the problem and the file is parsed perefectly after going via stringToIData. But then i get more problems later when i try to map the output into a record. Since both Header and Trailer have space in fromt of them in the ‘output’ of stringToIData.

Is there a way or a better way so i can avoid using a space in the schema, maybe a more cleaner schema definition?

Would appreciate all the input, just starting out on this, maybe there is a way i am totally ignoring.

Thanks much!

Harsh

Harsh,

I hope you have created the FlatFile Template and created the record structure (ISdocument)based on the template shown above.

When you parsed your fixedlength string with stringToIData and map the output record to a recordReference then i dont think you would will have problems.since the data will sit on the appropriate record and so H and T will filled with spaces and repeated data will be captured on the recordWithNoID structure.

Anyways can you elaborate on the mapping problem that you are facing?

Regards,

BTW if you have WmEDI Module4.6 installed on your IS then use the WmEDI services to load the template and created Schema/record structure and use the convertToValues service for parsing the flatfile in webMethods 4.6.
This way will be easier than using some custom services.

HTH,

Helo RMG thx for the reply:
i am trying to post my actual XML schema, but i think it doesnt show up when the message is posted on this board all the cap letters are converted to smaller case…but yes to elaborate on my problem.The parsing of the file gets confused when in the flat file the record with repeating fields (recordWithNoID) has a value which starts with either H or T since these are taken up as segmentID in the schema for Header and Trailer part of the flat file record. So i get a incorrect output. since in the flat file the values in there also start with a
‘T’–

H (Header)
Teresa Vacations 00000030056796666 Marshall (recordWithNoID)
T ( Trailer)

But when i added a space after the T in the Trailer segmentID field in the below schema, like <segmentid=“t(space)”> it then doesn’t confuse this with the recordWithNoID.
With the added space the output records are aligned correctly, but i can’t map parseFlatFiel –> ouput–> to a my own Trailer record since i cannot have a record named with a T(space) to map from the one i am getting, from stringToIData which is actually a custom service utilising in the flow the parseFlatFile service with output param.

Hope this is near a clear explaination of my problem, hope to hear some inputs…Thanks so much!

Harsh
<?xml>
<template>
<segment-delimiter>
<fixed>10</fixed>
<keyword></keyword>
<offset></offset>
</segment-delimiter>
<field-delimiter>
<fixed></fixed>
<keyword></keyword>
<offset></offset>
</field-delimiter>
<sub-field-delimiter>
<fixed></fixed>
<keyword></keyword>
<offset></offset>
</sub-field-delimiter>
<segmentid=“h”>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
</segment>
<segmentid=“recordwithnoid”>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
</segment>
<segmentid="t>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
<position>
</segment>
<seg-id>H</seg-id>
<seg-id>T</seg-id>
<loop>
<seg-id>recordWithNoID,</seg-id>
</loop>
</template>

Harsh,

If you map the custom parsing service output record to a recordReference(flatfile IS record) as i metioned above,then it wont cause the problem when mapping.Still i am not understanding why u are not using that way.

please clarify me and give step by step info of your parsing step.

And instead of using custome services try to use WmEDI module services for parsing.

HTH,

RMG, and anyone out there:

Still no luck, my incoming flat file is like this:

H WERER89000 04082023181000007
Travel Vacations 0825200420040002427840
Travel Vacations 0203940585993000199920
T VALIDATION 04082023181000007

is there a way in the template schema i can define, for it to differentiate between T as in trailer record and T as in Travel vacations (repeating record- recordWithNoID).

I noticed the below fields in the EDItemplate when creating my own template, can this be used to handle this, as i am hoping there is somthing already build in webMethods to parse the above file format:

<?xml version=“1.0”?>
<Template>
<SEGMENT-DELIMITER>
<FIXED>10</FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</SEGMENT-DELIMITER>
<FIELD-DELIMITER>
<FIXED>
</FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</FIELD-DELIMITER>
<SUB-FIELD-DELIMITER>
<FIXED></FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</SUB-FIELD-DELIMITER>

Below is my template, notice the space i have to give after the header and trailer segment id to uniquely identify this as a header and trailer and not to mix say a loop record starting with H or T, but this creates a problem as the output record Header (H) has a space. and i cannot branch on the record values say DATA_FILE/H

<?xml version=“1.0”?>
<Template>
<SEGMENT-DELIMITER>
<FIXED>10</FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</SEGMENT-DELIMITER>
<FIELD-DELIMITER>
<FIXED></FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</FIELD-DELIMITER>
<SUB-FIELD-DELIMITER>
<FIXED></FIXED>
<KEYWORD></KEYWORD>
<OFFSET></OFFSET>
</SUB-FIELD-DELIMITER>
<SEGMENT ID="H ">
<POSITION NAME=“RECORD_TYPE” START=“0” LENGTH=“1”/>
<POSITION NAME=“FILLER” START=“1” LENGTH=“12”/>
<POSITION NAME=“SECURITY_QUALIFIER” START=“13” LENGTH=“1”/>
<POSITION NAME=“SECURITY_PASSWORD” START=“14” LENGTH=“10”/>
<POSITION NAME=“VENDOR_ID” START=“24” LENGTH=“12”/>
<POSITION NAME=“INTERCHANGE_DATE” START=“36” LENGTH=“6”/>
</SEGMENT>
<SEGMENT ID=“recordWithNoID”>
<POSITION NAME=“WHOLESALER_NAME_CHARACTER” START=“0” LENGTH=“50”/>
<POSITION NAME=“ARRIVAL_DATE” START=“50” LENGTH=“8”/>
<POSITION NAME=“RESERVATION_NUMBER” START=“58” LENGTH=“15”/>
<POSITION NAME=“LAST_NAME” START=“73” LENGTH=“15”/>
<POSITION NAME=“FIRST_NAME” START=“88” LENGTH=“15”/>
<POSITION NAME=“TICKET_CODE” START=“103” LENGTH=“5”/>
</SEGMENT>
<SEGMENT ID="T ">
<POSITION NAME=“RECORD_TYPE” START=“0” LENGTH=“1”/>
<POSITION NAME=“FILLER” START=“1” LENGTH=“12”/>
<POSITION NAME="VENDOR_I