2 Replies Latest reply: Apr 8, 2015 5:50 AM by Grant Perkins RSS

    Extracting data from a flat file

    Sam Smith



      I have got a requirement to extract data from a flat file. The data is something similar to this 4661efdaCUSTOMER1f92f4cb7INVOICEaa9702ac496c6 20140806 Address1 Address2. So from the given data line I need to extract CUSTOMER1 and INVOICE. Could you please help me how to achieve this.


      Thanks in advance..

        • Re: Extracting data from a flat file
          Olly Bond

          Hello Sam,


          If the format is exactly as you describe, then you'll need to use lsplit() and extract().


          If the layout is over multiple lines, then working through Classic.PRN and Lesson10.DMOD in the tutorials should help.


          Best wishes,



          • Re: Extracting data from a flat file
            Grant Perkins



            Are the records in a fixed format with the same field length for each field irrespective of how many data characters the field has?


            If so it should be possible to simply specify the start position of the field and its length.


            If the structure is not fixed one needs to be a little more creative.


            Which version of Monarch do you have available?