Page 1 of 1

Good and Bad records

Posted: Mon Nov 07, 2005 12:10 pm
by Titto
Hi all,
I have a sequential file with Pipe delimited format, and i have layout for that. But the some of the input records are not following the Metadata layout, i would like to write those records to another file and good records to good file.

Good Input record with correct lay out:-
AAA|BBB|CCC|123456| | |XXXXX|YYYYY|ZZZZZ|

bad records are
AAA|BBB|CCC|123456| |XXXX
bad records are ending or missing layout....
need to write those in different file.

I tried using 'Discard and Warn' - Incomplete column in Input layout

Any help is appreciated!!

Posted: Mon Nov 07, 2005 12:24 pm
by ArndW
Titto,

I would recommend reading the sequential file as a 1 column file with no delimiters and in the first transform stage use the result of DCOUNT(In.BigColumn,'|') to see if the number of columns is correct and use the constraint to filter out badly formed records. You can then write the good records to a sequential file. This is then read (you should use the same sequential file stage in your job to ensure sequential processesing) with the same format as your current job works. If you need performance increases, then make this interim stage into a pipe type file for input and output and the data will not be written to or read from the disk.

Posted: Mon Nov 07, 2005 1:56 pm
by Titto
Hi ArndW

If i understood correctly,
first i need to read the source file with out any delimeters... and in the transformer use Dcount to get the number of delimeters (for example if i get the count of delemeters 50 then in the constraint Dcount(Link.rec,'|') = 50 then good records) and write to output file and use this output file as source to next transformer to write into a correct layout format.

I did the first part to get the Dcount from the main source file and got the 50 count.... then i used that number in constraint to write the records only with matches that value but it is writing all the records... Sure i am doing something wrong.

am i missing something!!!

Thanks!!!

Posted: Mon Nov 07, 2005 2:14 pm
by ArndW
I can't help you there. If your problem is as you stated, the bad records will have a different number of delimiters using the DCOUNT function and the constraint should catch it.

I would add an "ugly" stream (sorry, but I couldn't resist the temptation and I loved the movie).

Posted: Mon Nov 07, 2005 2:46 pm
by manteena
Replace DCOUNT with COUNT
Hope this solves your prob

Posted: Mon Nov 07, 2005 3:08 pm
by ameyvaidya
Hi Titto,
Please go through the following topic. U could adapt the info present there for your design:

viewtopic.php?t=95873&highlight=

IHTH