Load Zero Byte File

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Load Zero Byte File

Post 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 ?
Karthik
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Load Zero Byte File

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply