Hi! I need a little help in defining my input file type for three similar but different file formats. I would have thought this would be easy, but now maybe I've been staring at the screen too long, because nothing I've tried so far with the Type Tree works.
My input can consist of one of three different files, all similar in basic structure. Each of these three files has a header record, one or more detail records of the same record length, and a trailer record. The header and trailer record have the same format for all three files, but the detail record is slightly different (but, again, the same record length). So this would seem to point to using a partitioned group type for the detail record. The problem is, there is no uniquely identifying object in the detail records to differentiate between them. The differentiator is in the header record, which identifies who sent the file.
I could try bringing in the file with the detail record as a BLOB and, after reading the header record, use the RUN function to execute one of three different runmaps to recast the BLOG to the detail record type I need. I could also use one of three functional maps to break up the text BLOB using numerous MID functions for each output field. But both of these solutions seem like more work than is needed if there's a way to do this in properly defining the input Type Tree.
Any help is appreciated.
Pinned topic How to Partition Detail if Detail Record Type is in Header Record
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-04-01T21:50:27Z at 2013-04-01T21:50:27Z by SystemAdmin
Re: How to Partition Detail if Detail Record Type is in Header Record2013-03-30T07:07:30ZThis is the accepted answer. This is the accepted answer.I'm not sure partitioning is the best solution here (but I'm not known to be the greatest fan of partitions)
Anyway, you could :
- partition the file level to have three different subtypes (distinguish on header type, define the structures according to their own definition)
- use a Choice group to define the detail records possibilities (file made of a header, 1:s records (defined as a Choice with the 3 different details layout) and a trailer. Then use the header type to decide which fmap to call.
Hope this helps
Re: How to Partition Detail if Detail Record Type is in Header Record2013-04-01T20:32:23ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
thanks so much for the suggestions. I'm trying your first suggestion and am trying to partition at the file level. My input file is therefore a group of groups consisting of (group 1) a header record (group of fields), (groups 2-4) the three different detail record types (each also a group of fields), and (group 5) the trailer record (the last group of fields). When analyzing the tree however, I'm getting the error ".L132 - Invalid partitioning: TYPE has no SUBTYPEs". The type in error is the file group object.
I would have thought the subgroups (header, details, trailer) would suffice for subtypes.
Re: How to Partition Detail if Detail Record Type is in Header Record2013-04-01T21:50:27ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
Many thanks Laurent.