finding unix file

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
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

finding unix file

Post by Veni »

How to check file is found in a specific direcotry using datastage sequence.
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Use Unix find command in a Execute Command activity in your job sequence.
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could also investigate the WaitForFile stage, which actually doesn't have to wait at all. You can use it as a file existance checker, for example, and branch accordingly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

chulett wrote:You could also investigate the WaitForFile stage, which actually doesn't have to wait at all. You can use it as a file existance checker, for example, and branch accordingly.
i am using find #path#/Test.txt in execute command in sequence how do check the status.. if file found i need to do one process if not found another process... problem i encounter here is if file is not found , it is throug warning like this "file can't open ... no such file in directory' instead
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did you give the WaitForFile stage a shot? :?

Don't use 'find' as the command, try using something like 'test' instead. Check your man pages.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

chulett wrote:Did you give the WaitForFile stage a shot? :?

Don't use 'find' as the command, try using something like 'test' instead. Check your man pages.
yes i try with WaitForFile stage this success for file exits if file is not found i need to run another job. here in trigger what value do i need to check
beceause if file is not there job through warning and got aborted .
rv
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Set the WaitForFile to not wait and it will simply check for existance. Two links out - one 'Ok' link for the file being found and an 'Otherwise' link for when the file isn't found. By itself it should throw a warning, from what I recall.

Pretty much the same thing you'd do for the Execute Command stage with the 'test' command...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Hi,

Help for using the find command

find ./ -name FILENAME - to search from current directory

Regards
Sreeni
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vincentph
Participant
Posts: 1
Joined: Tue Apr 15, 2003 10:59 am

Post by vincentph »

ray.wurlod wrote:You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.
There may be another advantage to using the test command: we found that WaitForFile requres read permission on the file. That could be a problem if the process you are waiting for has sent the trigger file to your server via FTP in which case the file permissions may be such that your process cannot read it.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard! :D

And thank you for a useful contribution. Your observation makes a point that I know about, and should have mentioned rather than assuming everyone knows all there is to know about UNIX commands. :oops:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

vincentph wrote:
ray.wurlod wrote:You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.
There may be another advantage to using the test command: we found that WaitForFile requres read permission on the file. That could be a problem if the process you are waiting for has sent the trigger file to your server via FTP in which case the file permissions may be such that your process cannot read it.
Thanks a lot to every body.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi veni,
Also be aware of the fact that, if you it is designed to wait for a file which is about to produce by any other job, the WaitForFile stage will trigger the its sequence as soon as the file appear in the folder. But it is not sure the file present may or may not be a full file. :?
To overcome this you can produce a indicator file and you can check for that. :wink:

-Kumar
Post Reply