Page 1 of 1

usage of ait for file activity

Posted: Sat Oct 07, 2006 3:29 am
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.

Posted: Sat Oct 07, 2006 8:07 am
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.

Posted: Sat Oct 07, 2006 10:50 am
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

Posted: Sat Oct 07, 2006 2:54 pm
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:

Posted: Mon Oct 09, 2006 12:18 am
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.....

Posted: Mon Oct 09, 2006 7:42 am
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.