Check existence of a file from a Transformer

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
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Check existence of a file from a Transformer

Post by ag_ram »

Hey Folks

Is it possible to find if a file exists from a transformer stage ..can we have a constraint defined based on the existence and non existence of a file
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sure you can. You need to write a routine that checks for file existence and returns an appropriate return value which you can then check inside the transformer and proceed. I wrote a simple one months back. Search for it here.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post by ganesh123 »

I guess its possible from TX but you can check the existence of input file by using before job subroutine "DSWaitForFile"
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

DSguru2B wrote:Sure you can. You need to write a routine that checks for file existence and returns an appropriate return value which you can then check inside the transformer and proceed. I wrote a simple one months back. Search for it here.
Any keywords that i have to look for search ..
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I could'nt find mine, and dont have time to search for more, Ray has a similar routine to do the same. Click here.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You sure you want to do that in a transformer? Once for every row processed by the job?

Use the 'Initial Value' area of a Stage Variable to do that if you only need to check once, then leverage that variable in the constraint for the job run.
-craig

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