3 Replies Latest reply on Oct 8, 2021 9:24 AM by Lekha G M

    Multi Line flat file source puzzle

    Anna Amorim New Member

      Hello, I need to read a multi line flat file source to load the contents into a database.

       

      Here's an example:

       

      012909981000011A10CPF11111111111                                              JOHN DOE                              22021987

      012909981000011B10CPF11111111111      1ADDRESS              18760007CITY     STATE          COUNTRY

      012909981000011110CPF11111111111      23112020RG1234567891     00000010585CT     

       

      For each customer I'll always have 3 lines with the same initial code (in the example, 012909981000011110CPF11111111111)... and then the information I need, which is the name and date of birth (1st line), address (2nd line) and account number (3rd line).

       

      How can I achieve this?

        • 1. Re: Multi Line flat file source puzzle
          JanLeendert Wijkhuijs Guru

          Hi,

          Looking at your example I have one all deciding question.
          Is this all data related to one customer?
          If so the 16th character differs in the initial code hence this would identify the type of data which is provided in that specific line.
          If my assumption isn't correct it makes life a little bit more complicated but it is still possible to solve it.

          If my assumption is correct I would configure the source as fixed width with column 1 with position 1-15, column 2 with position 16, column 3 with position 17-32 and the rest of the line as column 4 for which I would apply logic in an expression after a sorter.

          If my assumtion isn't correct I would define the source as delimited with the delimiter a space or tab? and the option treat consecutive delimiters as one
          column 1 would need to be able to contain 32 characters and then 4 columns which would need to be able to contain the data which can be provided by the source.
          After the source qualifier a sorter and an expression and logic to identify the type of record you are processing.

          If you need further information don't hesitate to ask.

           

          Regards,

          Jan Leendert

          • 2. Re: Multi Line flat file source puzzle
            Santosh Gade Guru

            Is this flat file a regular flat file or a PWX mainframe file . If its a mainframe file you may be able to create multi layered copybook to read it .

            1 of 1 people found this helpful
            • 3. Re: Multi Line flat file source puzzle
              Lekha G M Active Member

              Hi,

               

              Please check if the following thread helps:

              How to read multiple rows of a file a key value

               

              Thanks,

              Lekha