1

I have requirement where I need to parse MuleSoft Flat File Schema to parse incoming file content, input file row to parse it and convert to Mule object. It should include parsing of multiple rows in a file with 5-7 attributes per row. I have seen many examples but no one is explaining how can we create flatFile schema to process the flat file in anypoint studio. Could you please help me for the same.

Input file -

1220612WEBL23555606CA01                                                                                                                                                                                                                               
200000162608361   FFVV220606D915552982635 4TKTT0140MAZUR/ISWAR APRIL                                             C    YXYYXY    /C9F6R1     MTHO                             DTD 0000                                       
G002389100000000000CAD2070231 0 996AC                              001          RESLE BALANCE                                                                                                                                   
700CAD     0.00            NO ADC      00                                                                                       0                                                                                       00142152020558 Y262990535  
889486594HGMRNL8785   00000000000082204CAD2  CC5  0423                             0423                     000000000020512   00000000000      CAD2  EX                                                                  000000      
8002389                   00000000000      CAD2  CA                                                                  00000000000                   00000000000                                                                                00000000000      
9002389                                                                                                                                                   AGT6490/00                                    CASH                                               
Z00625                                                                                                                                                                                                                                                   
blurfus
  • 13,485
  • 8
  • 55
  • 61
Avinash
  • 19
  • 6
  • 2
    Hi! Can you provide more information, like for example, how do you identify each row (what it's called the `tagValue`) to then parse the fields on it? I'm basing on this docs https://docs.mulesoft.com/dataweave/2.4/dataweave-flat-file-schemas – Jorge Garcia Sep 08 '22 at 18:58
  • Hi @Jorge I only have the document, I do not know how can we identify but I found some examples where they are parsing it on the basis of flat file schema but I do not know hoe are they creating it. https://apisero.com/flat-files-in-mule-4/ – Avinash Sep 08 '22 at 19:07
  • 1
    You need funtional information about the format you need to parse, where each field starts and ends. The combinations are endless. – Jorge Garcia Sep 08 '22 at 19:10
  • Thank you for your response, I found more information: File Headers 1 IT01 Object M IT01 First Line of File starting 255 Characters 1220612WEBL230PROD2206080606CA01 2 IT01.RecIdentifier M IT01 1 1 AN 3 IT01.ReportingSystemIdentifier M IT01 8 4 AN 4 IT01.ProcessingTime M IT01 25 4 N 1220612WEBL230PROD2206080606CA01 Format: HHMM(24Hr) IT01.ReseverdSpace M IT01 33 223 AN Reserved Blank Space in the Line END of RET File Headers Start of RET RETTransactions Group All Rows where rows starts with "2" still rows starts with "9"12 RETTransactions[] Array IT02-IT09 For Each group rows – Avinash Sep 08 '22 at 19:44
  • if we have flatfile how do we create .ffd schema file? – Avinash Sep 08 '22 at 19:54
  • Please edit the question and add the details there in a formatted way. It is very hard to read details in comments. It make more difficult to help you, and that makes unlikely to receive answers. – aled Sep 09 '22 at 12:51

1 Answers1

2

The basic steps are simple:

  1. Define the structure of the file. You need to understand the records and fields of the file completely.
  2. Convert that definition into a Flat file schema. Read the documentation, if the file has simple records structure it should be very direct.
  3. Use the schema in a DataWeave transformation

Flat file format are usually custom defined. It is very very unlikely that there is a tool to automatically translate it to a flat file definition since they lack delimiters and structure. You will have to read the definition of the structure and create the flat file schema manually. For that you need to understand how the flat files schemas are structured by reading the documentation. They are not complex, but you may want to start with simpler examples until you get the hang of it.

aled
  • 21,330
  • 3
  • 27
  • 34