Empty Source File

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Empty Source File

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

ROW COUNT

Post 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:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Jeepers Craig, you won that one.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not by much, it would appear. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Empty Source File

Post by amsh76 »

Thanks Guys..This Helps
Juls
Participant
Posts: 51
Joined: Tue Sep 14, 2004 9:17 am

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'd put it in a separate thread, since it's not about "empty source file" :evil:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply