Page 1 of 1

Issue while running After-job subroutine

Posted: Fri Oct 05, 2012 3:38 am
by sumesh.abraham
I have created a routine to compare data in 2 sequential files and take action on sync/non-sync scenarios. The arguments for the routine are the file path and I see ErrorCode is automatically added when I select the Type as 'Before/After subroutine'. In this case how should deal with the ErrorCode. I have specified the below statement as last line in routine

Code: Select all

Ans = ErrorCode
In the After job subroutine, I provided the argument as filepath 0
How should I define this? When I execute the job there is an issue with the error code returned. The error that I get is

Code: Select all

After-job routine returned error: Error variable unassigned on return from AFTER routine DSU.testroutine
What could be the issue here? Appreciate your help!

Posted: Fri Oct 05, 2012 3:45 am
by ArndW
You determine the return value for "ErrorCode" in your after-job routine. If the return value is nonzero then the job will consider that as an error and then abort.

Posted: Fri Oct 05, 2012 4:56 am
by sumesh.abraham
Thanks for the reply. All I am doing in the subroutine is reading 2 files and comparing them. If I assign ErrorCode to any desired value within the routine and provide the same in the After-job routine section of the job properties, will it work? I tried with value as 1 and 0, but I still get the same error.

Posted: Fri Oct 05, 2012 5:10 am
by ArndW
If you assigned 0 to ErrorCode in your routine, then you won't get that error message (which states that the variable hasn't been assigned).

Your routine will have 2 parameters, the first is what you pass in as a string, the second is the error code. Variables in UV-Basic are case sensitive.