Page 1 of 1

ROUTINE FAILING

Posted: Fri Jul 13, 2007 11:12 am
by srinivenigalla
Routine is working in one job and not working in another . Help me to resolve this.

SEQ_J_Stage_PS_S_BUS_UNIT_FS_HCM_test..JobControl (@GetNextBatchNumber): Routine DSU.GetNextBatchNumber did not finish OK, return code = '277'

is the error message.

It is working in other jobs.

Posted: Fri Jul 13, 2007 11:18 am
by narasimha
Please give more details about your routine, where it is used,....
Insufficient information to give any suggestions.

ROUTINE of EPM9.0 for getting Next batch number

Posted: Fri Jul 13, 2007 11:22 am
by srinivenigalla
It is used in all the sequences before the actual process is ran.Is this information sufficient

Posted: Fri Jul 13, 2007 11:30 am
by narasimha
Do you get any warnings/information from the job logs from the director?

Posted: Fri Jul 13, 2007 11:40 am
by srinivenigalla
SEQ_J_Stage_PS_S_BUS_UNIT_FS_HCM_test..JobControl (@GetNextBatchNumber): Routine DSU.GetNextBatchNumber did not finish OK, return code = '277'

is the message

Posted: Fri Jul 13, 2007 11:45 am
by chulett
Is '277' your next batch number, by any chance? Do your Sequence jobs 'automatically handle activities that fail'?

Posted: Fri Jul 13, 2007 11:54 am
by srinivenigalla
Nope it doesnt handle failure. I THINK THAT IS THE OLD BATCH NUMBER.

Posted: Fri Jul 13, 2007 12:05 pm
by chulett
NO NEED TO SHOUT, I MAY BE OLD BUT NOT DEAF. YET.

I find that hard to believe, but ok. So, you saying that '277' is not the next batch number and your Sequence job does not automatically handle failures? That property is not checked in the job?

You see, when that option is turned on and a routine does not return a zero, it is considered to have failed and the Sequence job logs a message that looks just like that one. Perhaps you might want to double-check. And why would your 'next batch' routine return an 'old' number? Perhaps you should post your routine code as well.

Posted: Fri Jul 13, 2007 12:10 pm
by srinivenigalla
Sorry, I am not shouting , it is typo mistake. Hope this gives you clear idea.

$INCLUDE DSINCLUDE JOBCONTROL.H

Deffun GetNextVal(A) Calling "DSU.KeyMgtGetNextValueConcurrentBATCH"

IF CurrentBatchNum = 0 THEN
* generate a batch number

GeneratedBatchID = GetNextVal(GlobalBatchName)
JobName = DSJobName
UserName = @LogName
StartTimestamp = DSJobStartTimestamp

* Setup J_Load_BATCH_INFO, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("J_Load_BATCH_INFO", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: SEQInfoJob", "JobControl")
Abort
End

ErrCode = DSSetParam(hJob1, "GeneratedBatchID", GeneratedBatchID)
ErrCode = DSSetParam(hJob1, "JobName", JobName)
ErrCode = DSSetParam(hJob1, "UserName", UserName)
ErrCode = DSSetParam(hJob1, "StartTimestamp", StartTimestamp)

ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)

If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: J_Load_BATCH_INFO", "JobControl")
End
DetachError = DSDetachJob (hJob1)

Ans = GeneratedBatchID

END
ELSE
Ans = CurrentBatchNum
END

Posted: Fri Jul 13, 2007 12:29 pm
by chulett
Your message obviously isn't coming from this routine. As for whether it returns the 'current' or 'generated' batch number there's no way for me to know and it doesn't really matter. I'm just going to repeat what I've said before and then leave it at that.

When a Routine Activity stage does not return a zero result, and the controlling Sequence job has the Job Properties / General / Compilation option of 'Automatically handle activities that fail' enabled, it will log a warning just like yours. I don't know of any other way your message would have been logged.

Posted: Fri Jul 13, 2007 12:50 pm
by srinivenigalla
Thanks for all the help but I think it is working sometimes nd it is not someother times.So, Hope fullly in the test environment it will work.

Posted: Fri Jul 13, 2007 12:50 pm
by srinivenigalla
Thanks for all the help but I think it is working sometimes nd it is not someother times.So, Hope fullly in the test environment it will work.

Posted: Fri Jul 13, 2007 1:25 pm
by chulett
You are missing an important point. Your routine is not failing, at least not in any obvious manner or you would be seeing some of your coded "JobControl" LogFatal messages. Your Sequence job considers it to have failed and treats it as such because of the non-zero return code. That's all.

You need to tweak your triggers so it knows a non-zero return is ok, something which is documented in the online help.