Routine - does file exist

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
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Routine - does file exist

Post by a2love »

Hi all,

I am a real newb with routine writing. I am trying to have a routing that looks for a file. If it exists then the routine is OK, otherwise it is a Fail.
Could anyone help me out on this? or point me to some resources that I can sift through to find a solution?

Thanks and happy thursday :)
Adam Love
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Routine - does file exist

Post by gateleys »

1. Do a list on the specified directory.
2. Use the list command within a DSExecute.
3. If the ReturnCode of the DSExecute is not equal to 0, it would mean, the file does not exist.

Simple as that.

gateleys
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Where do you want to run this routine? In a sequence job or inside a parallel job?
If former then you can use wait for file activity stage and set the time to 00:00:00.
If latter then you need to write a C routine to do this, how good are your C skills?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Post by a2love »

My C skills are beginner level :(. But for the wait for file stage, when time is 00:00:00 how will it act, meaning will it fail if once it reaces this point in the process if the file does not exist? (i know simple question, but I need to be sure)

Thanks.
Adam Love
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It will act uppon the trigger conditions you set. If your waiting for file to appear and its there, it wil show OK. Branch your execution accordingly.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Post by a2love »

Great. Thanks for your help. :D
Adam Love
Post Reply