usage of ait for file activity

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
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

usage of ait for file activity

Post by bollinenik »

Hi,

I need to set is file is there then trigger otherwise exit, output of first job is input for 2nd job, so, if no records are processed in 1st job then 2nd job will abort we should restrict triggering of 2nd job. Is it possible by using of wait for file activity........anybody tell me how we can use thet wait for file activity in this situvation.
kOTI,
1586-738-7785
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You should be able to use the Wait For File stage for something like that, if I'm following you. Set the Timeout Length to zero for a one time check.

Your problem will be the file will always exist, I would think, as the file will be created in a job but will be empty if nothing is written to it. You may want to write a routine that checks for the file and tests if it is empty rather than use the WFF stage.

In either case, you can trigger the second job (or not) based on the result of the check/wait.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Post by bollinenik »

chulett wrote:You should be able to use the Wait For File stage for something like that, if I'm following you. Set the Timeout Length to zero for a one time check.

Your problem will be the file will always exist, I would think, as the file will be created in a job but will be empty if nothing is written to it. You may want to write a routine that checks for the file and tests if it is empty rather than use the WFF stage.

In either case, you can trigger the second job (or not) based on the result of the check/wait.
thanks chulett

my problem is file won't be there if first job processed '0' records file won't create this some other thing....if file is there then no problem.....ok....any way thx i got logic and tested
kOTI,
1586-738-7785
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

bollinenik wrote:my problem is file won't be there if first job processed '0' records file won't create this some other thing
No, you will find that unless you are doing something super special - when a job runs that writes to a sequential file, it will always create the file. If the job 'processes 0 records' that means the output file will be empty, not non-existent.

Anyway, as you play with and test this you'll see what I mean. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Post by bollinenik »

chulett wrote:
bollinenik wrote:my problem is file won't be there if first job processed '0' records file won't create this some other thing
No, you will find that unless you are doing something super special - when a job runs that writes to a sequential file, it will always create the file. If the job 'processes 0 records' that means the output file will be empty, not non-existent.

Anyway, as you play with and test this you'll see what I mean. :wink:
HI Chulett,

I am not writeing to sequential file ia m writeing to SAP TABLE by using of BAPI stage it will return the values if any records were inserted or rejected in to that SAP table so, by using of that return values datastage is creating file if there are no return values then there is no file.......ok.......if you have any idea how to use wait for file activity tell me.....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok, that would have been good to know in your first post.

The WFF stage is simple to use, read the Help available on it. Since you really don't want to 'wait' for a file but rather check to see if it exists or not, do that by specifying a zero wait time as I mentioned earlier. Then two triggers from the stage will get you what you need - an 'OK' trigger for when the file is found and an 'Otherwise' when it isn't.
-craig

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