Hi,
I’m new to wb, so I’d like to know if anyone could please send me an example on working with Flat Files. I have read the pdf on FF, but still I’m not comfortable. I’m using wm 6.1
Here is an example of the file I have to parse:
FF fixed length, with 1 header, n details, 1 trailler. The header and trailler have they’re own fields, and all details have equal fields.
20050305ATESTFORFLATFILE001
20050305BINFO1INFO2INFO3002
20050305BINFO5INFO6INFO7003
20050305BINF81INFO9INFO0004
TRAILLERC 005
I’d like to see how you make the dictionary and the schema, to use them on the convertToValues…
Sorry for the basic question folks…
Thanks in advance,
Daniel
Daniel,
Based on your above FF sample you can create a Fixedlength Schema (select delimiter-newline)with recordWithNoID option.
Using the FlatFileEditor,
Create a RecordDefinition (recordWithNoID)this is casesensitive and under this create FieldDefinitions (fixedlength)header record.In the same hierrachy create another RecordDefinition (recordWithNoID)set this to MaxRepeated to “unlimited” shown in the properties panel and create FieldDefinitions (fixedlength)detail record and finally in the same header hierachy create another RecordDefintion (TRAILERC)and create fielddefinitions (fixedlength).
Test the flatfile.txt by using the Test tab in the editor.
HTH,
RMG
Hi RMG,
First of all, thank you for your help!
But now I’m stuck with another problem, maybe you (or somebody else) can help me again. Now I have a FF a bit more complicated, and I can’t get it to work. Here is the example:
AFILEHEADER
BGROUPHEADER
CDETAIL1
CDETAIL2
CDETAIL3
DGROUPTRAILLER
BGROUPHEADER
CDETAIL4
DGROUPTRAILLER
EFILETRAILLER
As you see, I have 5 record definitions. I have made a FFSchema with these 5 records (and their fields), but it’s only parsing correctly upt to the first “GroupHeader” (Record “D”). After that it messes up the document. I have tried placing all the records at level 0, and also placing record B inside A, and C inside B. I have tried them ordered and not ordered, but I never get the original layout.
Can you think of a way for this to work? Or will I have to loop through the records?
Thanks a lot,
Daniel
Daniel,
Sorry if this didn’t works.
Create a RecordDefinition (A)and under this create childs (FieldDefinitions)in the same hierarchy create RecordDefinition (B)set MaxRepeat to “Unlimited” which is in the Properties section and under this create childs (FieldDefinitions)in the same hierrachy create RecordDefinition (C)set to “Unlimited” and FieldDefinitions and in the A/B level itself create RecordDefinition (D)and fieldDefinitions and finally in the same level below A/B/D create RecordDefinition (E) and fieldDefinitions…
Test the SChema and still if parsing doesn’t works then shift the order
(RecordDefinitions)accordingly.
HTH,
RMG.