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:
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.
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?
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.
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!
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.
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:
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