Parse a tFileInputMSpositional to a XML file

One Star

Parse a tFileInputMSpositional to a XML file

Hello everybody,

Do you know how can I read a positioned file line by line and create a XML file according to its type located on the first 3 characters? 
I tried to develop the job below but It doesn't fit with the customer requirements because the output_XML regroup all the records according to its type.
I use a filter condition in the tMAP : rec_typ == 611 or rec_typ == 612
rec_typ is the first field



I read a tFileInputpositional with the folowing content:

61101FL8WA    VMACS    0104701048060413091920060413                                                                             
6120107060413 ST       S8F9     WF0HXXGAJH6T70706FIESTA 25BLUE    RC      FX K   1      621HA00000000000{          ........    
61301COLOGNE  60000GAJH 3S0920                                 000000     FORD MOTOR COMPANY AB        ATT: ACCOUNTING NBA      
61401029208660F   B2XX2AF13AAB53SS8F905   GAJH6T70706  FUX BKST15 JJMW27G5F2G 1E L  KG C2  T  W 1OA   97712      00000000{      
6150120060505Y60000 ET   2006041300000000                    200604132006041820060506                          WF0HXXGAJH6T70706
6120107060413 ST       S2CV     WF0LM2E406W504640RANGER DBBLACK           5B 4    010101625HA00001501390{SEK                   P
61301ZEEBRUGGE13000MW2E HS0949                                 000000     FORD MOTOR COMPANY AB        ATT: ACCOUNTING NBA      
61401029095707FORDJ97R2SF13AAB5HSS2CV99   MW2E6504640  5JB  4STBEA L           1 3            H   E   32484      00000000{     .
6150120060517N13000 SB   2006041300000000                                                                      WF0LM2E406W504640
6120107060413 ST       TT69     WF0WXXGCDW6T15750C307 ESTASILVER  RC      XF W          621HA00000000000{          ........    
61301SAARLOUIS60000GCDW 3S0936                                 000000     FORD MOTOR COMPANY AB        ATT: ACCOUNTING NBA      
61401029507208F   CW172AF13AAD53STT6901   GCDW6T15750  XQF  WST  AKBO A7C BAB3C  CC12141B  B7 O  AE  297659      00000000{      
6150120060505Y60000      2006041300000000                    200604132006041820060513                          WF0WXXGCDW6T15750
6120149080528 SK       2L3F     WF0GXXTTPG8C21546                                 000000898  00000000000{          X#GNMI   612
61301KOCAELI       TTPG KC070203Grande Benelux                 000000  KOI                                                      
61401033906012        2SSK   E KC2L3F99   TTPG8C21546  ULB 3 SK  1H7  W7L 6D82   2BYH4YB2KZ 1CM  33              00000000{      
6150120080616N15860      2008052800000000   VAL PORT 20080612                        001                       WF0GXXTTPG8C21546
61901000000100000040000004000000400000010000000000000000000000000004


And I would like to create only one xml with the exact content and do not use any element group.
Do you know how may I accomplish this ?

I tried also to use the tFileInputMSpositional but I don't know how to create only one outputXMLfile

Thanks in advance for your help

Re: Parse a tFileInputMSpositional to a XML file

if you can provide examples of what XML schema you want and what you've been able to produce I'm sure we can assist. 
One Star

Re: Parse a tFileInputMSpositional to a XML file

Hi ,
Thank you for your answer and yes my first message was not crystal clear.
For example I have this file in input:



61101FL8WA    VMACS    0104701048060413091920060413                                                                             
6120107060413 ST S8F9 WF0HXXGAJH6T70706FIESTA 25BLUE RC FX K 1 621HA00000000000{ ........
61301COLOGNE 60000GAJH 3S0920 000000 FORD MOTOR COMPANY AB ATT: ACCOUNTING NBA
6120107060413 ST S2CV WF0LM2E406W504640RANGER DBBLACK 5B 4 010101625HA00001501390{SEK P
61301ZEEBRUGGE13000MW2E HS0949 000000 FORD MOTOR COMPANY AB ATT: ACCOUNTING NBA
6120107060413 ST TT69 WF0WXXGCDW6T15750C307 ESTASILVER RC XF W 621HA00000000000{ ........
61301SAARLOUIS60000GCDW 3S0936 000000 FORD MOTOR COMPANY AB ATT: ACCOUNTING NBA
6120149080528 SK 2L3F WF0GXXTTPG8C21546 000000898 00000000000{ X#GNMI 612
61301KOCAELI TTPG KC070203Grande Benelux 000000 KOI
61901000000100000040000004000000400000010000000000000000000000000004



And I would like to produce this kind of XML:


out.zip.zip
One Star

Re: Parse a tFileInputMSpositional to a XML file

hi,
Do you have any idea ?

Re: Parse a tFileInputMSpositional to a XML file

take a look at the tXMLMap component. you use it like a tMap, but to build XML Documents 

you'll want to set the loop element as VEH_ID_NUM and set "all in one" to true
One Star

Re: Parse a tFileInputMSpositional to a XML file

Thx for your answer.
In my case do I need to use a tFileInputPositionnal or a tFileInputMSpositional ?

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads