0 Replies Latest reply on Sep 11, 2019 8:56 AM by Suraj Sasidharan

    UDT Parser - Delimited Dynamic text file

    Suraj Sasidharan New Member

      I am evaluating if the below need will be possible by Informatica developer Data processor transformation and parser. Could you please check and help? Please see the input and expected output below.

       

      Need: Convert multiple versions of Pipe delimited text file into a single version.

       

      Input files:

      File Version 1:

      Name|Amount|Vehicle|City|Visits|Indicator

      Jack|123.22|Volkswagen|Altamonte|1|Y

       

      File Version 2:

      Suffix|Name|Vehicle|City|State|Visits|Indicator|Gender

      Mr|Jack|Volkswagen|Hoboken|NJ|1|Y|M

       

      Output File (keep both records in version 1):

      Name|Amount|Vehicle|City|Visits|Indicator

      Jack|123.22|Volkswagen|Altamonte|1|Y

      Jack||Volkswagen|Hoboken|1|Y

       

      The new fields and corresponding data could go to a separate output file.

       

      Here are the planned steps for the script.

      1. Identify the first field in header till the first delimiter and store in a variable.

      2. Compare if the variable has the value "Name". To make this possible, can constants be defined in the Parser?

           If value matches the constant, Move the marker to next line (first data record) and read the content till the first delimiter.

           If not, move the marker to next line (first data record) and read till first delimiter and store the length/offset. Can the length/offset be stored using the parser, to be checked back later in the parser?

      3. Can the marker be moved back to the first line and read the header till next delimiter? Then repeat the step 2 for the next header column to be moved to output. While reading the data record, use the stored offset as beginning point and read till next delimiter.

       

      Thanks,

      Yours Truly.