Page 1 of 1

empty file

Posted: Sat Aug 14, 2010 3:43 am
by harikumar
hi
i my source table having 5 columns but target i want only empty file(with out columns) by using transformer

Posted: Sat Aug 14, 2010 5:15 am
by kris007
You can still map the five fields to the Sequential File stage from the Transformer. In the transformer stage make sure you default all the column derivations to empty strings(''). Make sure you set the First line is Column Names property to True and at the end of the job you will have an empty file. Restricting the row counts out of the transformer stage using system variables is up to you.

P.S. That's a unique requirement.

Posted: Sat Aug 14, 2010 5:35 am
by chvenkat.v
Don't post interview Questions here.

Posted: Sat Aug 14, 2010 6:49 am
by Sainath.Srinivasan
Don't do anything. Simple.

Posted: Sat Aug 14, 2010 7:45 am
by chulett
You'll have to do something to ensure you get an empty file from a non-empty source. For example, put something in the where clause that ensures you select zero records, where 1 = 2 for example. Or use a contraint in the transformer that ensures no records get past, @FALSE comes to mind.

Posted: Sun Aug 15, 2010 4:27 am
by Sainath.Srinivasan
chulett wrote:You'll have to do something to ensure you get an empty file.
Why ?

You can create an empty file whilst creating your project. Just don't do anything with that file afterwards.

No delete.....so no create.

Posted: Sun Aug 15, 2010 7:47 am
by chulett
Why? Because I made the silly assumption that (since we're here) the question was not simply how to create an empty file but how to create an empty file using a DataStage job. It's unclear just how "empty" they want it to be, so I was also assuming it should be empty of data but still have the column names in there, otherwise what's the point? Without that all you need is a zero byte file and you can use touch or an equivalent to do that. :?

Posted: Sun Aug 15, 2010 10:17 am
by grimm336
Hey i think you are not clear with the requirment. If you want to do some kind of funny tricks then dont post this kind of queries......