Good and Bad records

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Good and Bad records

Post 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!!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Post 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!!!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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).
manteena
Premium Member
Premium Member
Posts: 38
Joined: Thu Feb 10, 2005 1:43 pm
Location: USA

Post by manteena »

Replace DCOUNT with COUNT
Hope this solves your prob
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post 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
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
Post Reply