Page 1 of 1

After job subroutine

Posted: Fri Feb 08, 2008 3:22 am
by dsuser08
Hi

I have developed a simple job loading data from sequential file into database.Job is working fine.I have written a routine to load log in a text file.When i tested it as transform function routine it is working fine.When I converted it to After job subroutine.Job gets aborted.I am not able to compile the job.It give an error " Cannot give mutually exclusive access to job".
In After job subroutine,First parameter is jobname .Second parameter is error.How should I pass the value in the input value column of job properties.Can i give comma and pass the values.

Please help

Posted: Fri Feb 08, 2008 3:36 am
by ArndW
I haven't seen that error message and am unclear how you could be generating it.

The Before/After job routines have 2 parameters, the first is input to the subroutine and can contain whatever you wish while the 2nd is returned and contains the ErrorCode. If you wish to pass more than one value to a Before/After subroutine you need to put those values into one string and parse them in the routine, i.e. if you wish to pass parameters "JobName" and "TheAnswer" you would call the routine "#JobName#,#TheAnswer#" and in the routine parse the elements using something like "Field(InputArg,',',1)"

Posted: Fri Feb 08, 2008 6:22 am
by dsuser08
Thanks so much for your reply.Now its accepting the jobname as parameter in the after job routine,but its not getting the log into the text file.Job fails with error "unable to attach job".I am using dsattachjob within
routine.

But the routine is working fine when I had it as transform function .I get output in seconds

Please help

Posted: Fri Feb 08, 2008 6:51 am
by MOHAMMAD.ISSAQ
I think you're calling "DSLogFatal" function.This function never return to the before/after sub routine.It's better if you used "DSLogWarn".

Posted: Fri Feb 08, 2008 6:56 am
by dsuser08
I am not using DS.Logfatal...
Still am facing the same issue.

Posted: Fri Feb 08, 2008 7:15 am
by ArndW
You are probably attaching to the job itself in the after-job routine. Instead of using DSAttachJob(), just use the mnemonic DSJ.ME for the job handle.

Posted: Fri Feb 08, 2008 7:27 am
by dsuser08
Thanks so much Arndw

Posted: Fri Feb 08, 2008 7:43 am
by chulett
Exactly. If/when that fixes your problem, please mark the topic as Resolved. :wink: