DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message

Group memberships:
Premium Members

Joined: 26 Oct 2017
Posts: 133

Points: 2153

Post Posted: Wed Jan 03, 2018 1:04 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Server
OS: Windows
Hi Everyone,
I have a pretty basic routine that reads the contents of a text file. The routine does work successfully, but it appears if I enable "Automatically handle activities that fail" in my sequence job properties, this sequence causes the job's exception handler to trigger, even though it was in fact successful at reading the file. The code for the routine is as follows:
Routine = 'ReadFile'

vFileName = Arg1

vArray = ''

vCounter = 0

OPENSEQ vFileName to vFileHandle

Else Call DSLogFatal("Error opening file list: ":vFileName,Routine)


While READSEQ vLine FROM vFileHandle

vCounter = vCounter + 1

vArray<vCounter,1> = Fields(vLine,',',1)

vArray<vCounter,2> = Fields(vLine,',',2)

vArray<vCounter,3> = Fields(vLine,',',3)


CLOSESEQ vFileHandle

Ans = vArray

Here is the Summary of Sequence run:
    WireXchange_Processor..JobControl (@Coordinator): Summary of sequence run
    12:36:47: Sequence started
    12:36:47: Wait_For_File (ROUTINE DSWaitForFile) started
    12:36:47: Wait_For_File finished, reply=0
    12:36:47: DateTime (JOB DateTimeToString) started
    12:36:51: DateTime (JOB DateTimeToString) finished, status=1 [Finished OK]
    12:36:52: Read_Date_Time_String (ROUTINE DSU.ReadFile) started
    12:36:52: Read_Date_Time_String finished, reply=2018-01-03_1236_PM
    12:36:52: Exception raised: @Read_Date_Time_String, Unhandled failure (2018-01-03_1236_PM ) encountered calling routine DSU.ReadFile
    12:36:52: Exception handler started

    12:36:52: Failure_Email (ROUTINE DSSendMail) started
    12:36:52: Failure_Email finished, reply=0
    12:36:52: Sequence finished OK

note the lines in bold, its as if it's reading the contents of the file itself as the failure message?


Group memberships:
Premium Members

Joined: 03 Mar 2002
Posts: 1017
Location: Tampa, FL
Points: 6551

Post Posted: Wed Jan 03, 2018 1:43 pm Reply with quote    Back to top    

A routine activity must return 0 (reply=0) or it will trigger the exception handler.

I suggest calling your routine from a user variable.

A routine that returns anything besides zero requires a trigger to handle that non-zero reply.

Rate this response:  

Premium Poster

since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42836
Location: Denver, CO
Points: 220819

Post Posted: Wed Jan 03, 2018 2:07 pm Reply with quote    Back to top    

Your other option is to note the fact that it is handling it because it thinks you are not - hence the "unhandled exception" noted in the log. If you explicitly have triggers that cover failure, say an "okay" and an "otherwise" trigger (even if both go to the same spot), it will not trigger that exception handler. This used to be noted in the documentation along with specific trigger examples for those options, I assume it's still there. Somewhere. Wink


Your brain is full of spiders, you've got garlic in your soul, Mr. Grinch!
I wouldn't touch you With a thirty-nine-and-a-half foot pole!
Rate this response:  

Group memberships:
Premium Members

Joined: 26 Oct 2017
Posts: 133

Points: 2153

Post Posted: Thu Jan 04, 2018 1:08 pm Reply with quote    Back to top    

Thanks Gentlemen!
I did indeed call the routine from a user variable, which highlighted an idiot mistake I had made as the very next stage after my Routine Activity stage was a UserVariable Activity stage to trim the returned value of the routine activity... Doh! Consolidated that into JUST the UserVariable and that took care of that. I did end up disabling automatic exception handling in lieu of using a sequencer set to ANY and using failure triggers from each important stage in the job. I used another UserVariables Activity stage and nested IF THEN ELSE to get the name of the failed job/stage for use in the email notification subject.

Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours