ROUTINE FAILING

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

ROUTINE FAILING

Post 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.
Last edited by srinivenigalla on Fri Jul 13, 2007 11:42 am, edited 1 time in total.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Please give more details about your routine, where it is used,....
Insufficient information to give any suggestions.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

ROUTINE of EPM9.0 for getting Next batch number

Post by srinivenigalla »

It is used in all the sequences before the actual process is ran.Is this information sufficient
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Do you get any warnings/information from the job logs from the director?
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Is '277' your next batch number, by any chance? Do your Sequence jobs 'automatically handle activities that fail'?
-craig

"You can never have too many knives" -- Logan Nine Fingers
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

Post by srinivenigalla »

Nope it doesnt handle failure. I THINK THAT IS THE OLD BATCH NUMBER.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

Post 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.
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply