2

In Ab Initio graph I have an input file which has pipe-delimited values in rows. I use similar DML file to parse it:

record
  decimal("|",0, maximum_length=19, sign_reserved) v1 = NULL("");
  utf8 string("|", maximum_length=10) v2 = "";
  utf8 string("|", maximum_length=10) v3 = "";
  utf8 string("|", maximum_length=40) v4 = "";
  utf8 string("|", maximum_length=255) v5 = "";
  utf8 string("\n", maximum_length=40) v6 = "";
end

For use in later equality comparisons with other data I want to make all those strings pipe-delimited, so I need to change v6 value.

I tried do it with simple Reformat by changing output DML to this one, and leaving the transform function empty:

record
  decimal("|",0, maximum_length=19, sign_reserved) v1 = NULL(""); 
  utf8 string("|", maximum_length=10) v2 = "";
  utf8 string("|", maximum_length=10) v3 = "";
  utf8 string("|", maximum_length=40) v4 = "";
  utf8 string("|", maximum_length=255) v5 = "";
  utf8 string("|", maximum_length=40) v6 = "";
  string(1) newline = "\n";
end

However, this left trash character inside v6. Later I needed to filter v6 value to make it only contain proper characters. This solution doesn't seem neat.

To avoid this trash left inside v6 I tried to use reinterpret_as, string_concat and others but nothing ended up with a nice solution. How should I change the delimiter of v6 in a simple way?

Denikin
  • 21
  • 1
  • 8
  • I have ran your solution but worked fine, No trash character inserted in o/p file. Please check your input if you already have trash characters in it. If so then you have to do proper cleanup of your data depending upon the probability of getting that chars. – chanchal1987 Apr 16 '13 at 17:19

1 Answers1

3

A == B compares the value of A to the value of B. The comparison returns the same result regardless of whether A and B have the same delimiter or not. If you actually do need to change the delimiter of a field, the Reformat method you suggest is the correct one. If you're seeing garbage in the v6 values coming out, it means there was garbage in v6 going in.

More broadly speaking, Stack Overflow isn't the right venue for discussing things Ab Initio. You'd be better off posing your question to Ab Initio support or on the dedicated Ab Initio Forum accessible through the GDE. The Forum is monitored by numerous Ab Initio users and employees, and you're pretty much guaranteed to get a prompt response.

Chris Arnesen
  • 1,195
  • 1
  • 9
  • 13