Hi Folks,
Just want to borrow your brains. Is there a way to handle errors/exception
inside a server routine (DataStage basic)? I have the function below, and it throws a fatal error when the link doesn't exist which make the job abort.
Routine name : GetRowCount
$INCLUDE DSINCLUDE JOBCONTROL.H
hJob = DSAttachJob(JobName, DSJ.ERRFATAL)
RowCount = DSGetLinkInfo(hJob, StageName, LinkName, DSJ.LINKROWCOUNT)
ErrCode = DSDetachJob(hJob)
Ans = RowCount
Error handling inside of a server BASIC routine
Moderators: chulett, rschirm, roy
Error handling inside of a server BASIC routine
A bad fishing day is much better than a great day at work
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The second argument of DSAttachJob() specifies error handling. If you use DSJ.ERRNONE you have to handle error conditions yourself.
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
CheckName = DSGetJobInfo(hJob, DSJ.JOBNAME)
If CheckName = DSJE.BADHANDLE
Then
Ans = @NULL
ErrMsg = "Unable to attach job " : Quote(JobName) : "."
Call DSLogWarn(ErrMsg, "GetRowCount")
End
Else
RowCount = DSGetLinkInfo(hJob, StageName, LinkName, DSJ.LINKROWCOUNT)
ErrMsg = ""
Begin Case
Case RowCount = DSJE.BADSTAGE
ErrMsg = "Stage " : Quote(StageName) : " is not a stage in this job."
Case RowCount = DSJE.BADLINK
ErrMsg = "Link " : Quote(LinkName) : " is not a link connected to stage " : Quote(StageName) : "."
End Case
If ErrMsg = ""
Then
Ans = RowCount
End
Else
Ans = @NULL
Call DSLogWarn(ErrMsg, "GetRowCount")
End
End
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.