I’m trying to parse a file using two schemas as described in the Gear 6 Flat File implementation guide. I’m first applying a schema containing only the header and trailer record, and I’m capturing the body in ‘unDefData’.
Now I want to parse the data in ‘unDefData’ using another flat file schema, but I can’t find a way to do this. The reason I’m using two schemas is that I’m using the information from the header to determine which second schema I should use.
Any help would be greatly appreciated!
Actually create only one schema to parse the flatfile (headerdata/trailerdata).UnDefData means it is not able to parse correctly since the schema is not matching the according to file.
Please check the ISFlatFileSchemaGuide.pdf, WmFlatFileSamples package for better understanding about managing of flatfile Dictionaries/Schemas.
What errors are you getting when you pass undefdata to the second schema.
I was just browsing the GEAR 6 Flat File Implementation Guide.pdf and found an example describing exactly what you want to do. Have a look at the example starting on pg. 9 and see if that helps.
Thanks guys. I was able to pass ‘undefdata’ into another converttovalues function and apply the second schema to it.
Do any of you know how reliable ‘undefdata’ is to use? My concern is that for large files, the ‘undefdata’ string may not be able to store all the information, and may truncate some information if the string is only allowed a maximum length.
As per my understanding ,unDefData string can hold any amount of data and there are no such restrictions on the max lenth.
If you are expecting large files you should set the ‘iterate’ parameter to true.
What I’ve done is loaded a stream and parses the header using one schema and set allow undefined data to true. You get an ffIterator variable as output to ‘convertToValue’ which keeps track of the input data. It will be stored on disk for large files. Then I parse the stream again with a different schema and using the ffIterator as input instead of the stream this time. Don’t worry about the length being cut off.