wait for file activity

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
satyakunta
Participant
Posts: 5
Joined: Fri Jun 03, 2005 9:08 am

wait for file activity

Post by satyakunta »

Hello,

I have a strange problem with respect to the wait for file activity:

i am trying to write to a sequential file from a table giving the status of the job sucessfully run or not,
i put the constraint on the trnsformer that if the count(status)=0 write to the file with single column as "sucessful"which means that if the count of "N" (i.e NO) = 0 then it writes to the file at a specified location (it creates a dat file)

but when the count is > 0 then it should not write to the file, and it should not generate a file, but to my surprise the job is creating a 0kb file which the wait for file activity takes as present and the runs the next step.

If it were to be in unix i would have used test-s command to check the size of file>0, but i am working on NT.

Is there any DOS commond to check the size of the file greater than 0kb and to delete the file?

or is there a better way to do this.

Thanks

Satya
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Welcome. :D

You can't stop the stage from creating the file, it does so when the stage cranks up or 'opens'. If you don't write to it, what you are left with is a zero byte file. As you've found.

Given the path you've been taking with this, I'd suggest you write your output file to a different name, one the Wait For File activity is not polling for. Take the mechanism you are using for the constraint right now and pass that count or status out to an 'after job' script. Based on that parameter, have the script either rename the file to what the wait activity is expecting or... delete it.

I would think something like that would work.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is there any DOS command to check the size of the file greater than 0kb and to delete the file?
If you're on 7.5 with MKS toolkit, or have MKS toolkit anyway, then you can write a UNIX script to do this. Something like:

Code: Select all

if [ -z $filename ] then
   rm $filename
fi
I don't know if there's a DOS equivalent. Maybe there is, maybe there isn't. But just crank up sh and you can do the UNIX thing. From a cmd shell, just type sh (the prompt changes to "$"). Then type man sh to find out more about the shell.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply