Page 1 of 1

Load Zero Byte File

Posted: Mon Oct 19, 2015 2:52 am
by karthi_gana
All,

I have to load zero byte file into the table whereas the filename and reason as "File is Empty" needs to be loaded into the table.

My Job design is something below

SeqFile --> Transformer --> TeraData Connector

If the Input file is zero byte none of the record will be uploaded into the database.

Simply O Rows will be processed.

But instead, I want to insert a row into the table with FileName and reason as "File is Empty".

How to change the above design to accommodate this logic ?

Posted: Mon Oct 19, 2015 6:37 am
by ShaneMuir
You could have a file which is the same structure as your input file that has your default message in it.

You could then use the same input stage with multiple file names. Make sure you sort the data ensuring that your default data comes last. You can then filter the line out if the number of input lines is greater than one?

Re: Load Zero Byte File

Posted: Mon Oct 19, 2015 7:23 am
by chulett
karthi_gana wrote:If the Input file is zero byte none of the record will be uploaded into the database.
Rather than saying "none of the record will be uploaded" it would be more correct to note that there is no record to be uploaded.

Another option - check the file size before processing it. When it has data, use your normal job to load it. When it is empty, load it using a job specifically designed for this scenario - take the filename and generate your "File Is Empty" record. More obvious what is going on in that case.