Page 1 of 1

Empty Source File

Posted: Tue Jun 15, 2004 5:03 pm
by amsh76
I want to give a warning when the source file is empty but the job should not abort. Right now if I have an empty source file, the the job aborts as the source spage cannot read the file. Can anyone tell me how to handle this situation?

My requirement is that the job should not abort but should give a warning.

Posted: Tue Jun 15, 2004 5:13 pm
by chulett
Something else is wrong - an 'empty' source file should not cause a job to fail. It should simply run and process no records - no errors, no warnings - just start up and shut back down and do a whole lot of nothing. :?

If the job aborts, it should only be because the source file does not exist, or perhaps because the data is not in the proper format.

You can check in an after job routine the number of rows the job processed and write a warning to the log if the number is zero. Check out the DSGetLinkInfo function in your online help with the DSJ.LINKROWCOUNT InfoType.

ROW COUNT

Posted: Tue Jun 15, 2004 9:06 pm
by amsh76
Thanks Craig,

But when I am trying to run after job routine for row count, its giving compilation errors. Says DSAttachJob needs to be dimensioned. What I am trying to do is first Attach the job, then get job info, stagelist and then row count. But its not working... :cry:

Posted: Tue Jun 15, 2004 9:13 pm
by chulett
Put this at the top of your routine:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 
Or more properly:

Code: Select all

$IFNDEF JOBCONTROL.H 
$INCLUDE DSINCLUDE JOBCONTROL.H 
$ENDIF

Posted: Tue Jun 15, 2004 9:13 pm
by kcbland
In order to use the job control APIs you must put this statement at the top of your function/routine (courtesy of Ray Wurlod):

Code: Select all

$IFNDEF JOBCONTROL.H 
$INCLUDE DSINCLUDE JOBCONTROL.H 
$ENDIF 
The include statement adds the API definitions to your function.

Posted: Tue Jun 15, 2004 9:14 pm
by kcbland
Jeepers Craig, you won that one.

Posted: Tue Jun 15, 2004 9:15 pm
by chulett
Not by much, it would appear. :wink:

Empty Source File

Posted: Tue Jun 15, 2004 9:32 pm
by amsh76
Thanks Guys..This Helps

Posted: Thu Sep 30, 2004 2:38 pm
by Juls
Hi, I am pretty new to DS and not too familiar with BASIC and routine execution.

I am having the same problem as described here: Job Fails and Aborts if Data source is empty. (I am running on Windows).

Where would I place this routine to get row count as described here?

DSGetLinkInfo(DSJ.ME, "src_tbl_SW_VAL_PRODUCT","lnk_GO_TO_SORT_1",DSJ.LINKROWCOUNT)

Thanks.

Posted: Thu Sep 30, 2004 5:00 pm
by ray.wurlod
I'd put it in a separate thread, since it's not about "empty source file" :evil: