Page 1 of 1

Filter Option in Sequential File

Posted: Sun Jun 15, 2008 5:48 pm
by 199542
Hi All ,
I am facing a problem in using filter option in sequential file .Suppose i am using head -1 in the filter property of output tab, I am not able to see any difference in the ouput .....
I tried with 'sed' command also ....still same result ....
Can anybody help regarding how to use this property ??

Thank you

Posted: Sun Jun 15, 2008 6:42 pm
by ray.wurlod
Your head -1 command needs to be followed by the file name. The Sequential File stage reads stdout of the command rather than reading the file and applying the filter command to it.

Posted: Sun Jun 15, 2008 8:05 pm
by 199542
ray.wurlod wrote:Your head -1 command needs to be followed by the file name. The Sequential File stage reads stdout of the command rather than reading the file and applying the filter command to it. ...

Hi ray ,
Thank you for your reply .Still i am facing the same problem even though i specified as you suggested head -10 filename

I know that we can use external filter .But , i want to know how this filter option can be used ??

Is there any other way to use this filter option in Sequential stage.?

Thank you all in advance .

Posted: Tue Jun 17, 2008 6:51 am
by OddJob
You don't need to include the filename as part of the filter command. Each record is passed to the command via a pipe, with the output from the command being piped to DataStage. The file used is that which is defined in the 'File' property.

I just confirmed my understanding by creating a job with a sequential fie stage, checking I could read a file using the 'View Data' button, then applying a filter of 'head -1'.

I found that with the filter I only viewed one record, whereas all records were shown without the filter.

Make sure you can 'View Data' the file correctly before applying a filter, and check you have correctly set up the file format e.g. UNIX line terminator etc.

Posted: Tue Jun 17, 2008 7:02 am
by DSRajesh
Lets try this head 10 < filename