Preventing an ftp if file is zero length

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
kld05
Charter Member
Charter Member
Posts: 36
Joined: Fri Apr 28, 2006 8:12 am

Preventing an ftp if file is zero length

Post by kld05 »

Hi all,

Is there a simple way to pevent an ftp if the file doesn't contain any records? My job is currently creating a zero length file. I know I could write an after script to do this but just wanted to confirm that was the only way.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Are ftp'inf the file in a job or in a sequencer.
Do the file has column header.
kld05
Charter Member
Charter Member
Posts: 36
Joined: Fri Apr 28, 2006 8:12 am

Post by kld05 »

This is in a job without header information.
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Re: Preventing an ftp if file is zero length

Post by Krazykoolrohit »

kld05 wrote:Hi all,

Is there a simple way to pevent an ftp if the file doesn't contain any records? My job is currently creating a zero length file. I know I could write an after script to do this but just wanted to confirm that was the only way.
Check it in unix before you run the job. use If condition like

If -s filename then run job else abort

Or use sequencer and use activity stage to check if -s filename returns 1 or 0 and use conditional links to control the flow.
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Re: Preventing an ftp if file is zero length

Post by thumsup9 »

Krazykoolrohit wrote:
kld05 wrote:Hi all,

Is there a simple way to pevent an ftp if the file doesn't contain any records? My job is currently creating a zero length file. I know I could write an after script to do this but just wanted to confirm that was the only way.
Check it in unix before you run the job. use If condition like

If -s filename then run job else abort

Or use sequencer and use activity stage to check if -s filename returns 1 or 0 and use conditional links to control the flow.
I think he meant Test -s Filename. You can use this in COmmand Actvity Stage or a routine.
prabu
Participant
Posts: 146
Joined: Fri Oct 22, 2004 9:12 am

Re: Preventing an ftp if file is zero length

Post by prabu »

kld05 wrote:Hi all,

Is there a simple way to pevent an ftp if the file doesn't contain any records? My job is currently creating a zero length file. I know I could write an after script to do this but just wanted to confirm that was the only way.
1)use a contol job and check for the readiness of the file before you call the ftp job

2)Don't create an empty file if there is nothing to write[Meaning change your ftp script which actually does this]

3) use a .ready file as a ftp checker file [Wait for file activity in Sequencer].

some thoughts!

regards,
Prabu
Post Reply