Server Routine returning -1 in the Actual Job

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
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Server Routine returning -1 in the Actual Job

Post by ankursaxena.2003 »

Hi,

I have built a user defined Server Routine.
I compiled and tested the Server Routine, it works fine.

When I called this Server Routine in another Server Job, it is returning me -1 value.

Any help will be appreciated.....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Did you write a DataStage Routine or a Function? I will assume you wrote a function, as you are writing about a "return" value. In DataStage the design interface automatically returns the value of variable "Ans". Thus we need to know how you are assigning this value in your code in order to guess why the behaviour is different in your environments.
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

I wrote a Server Routine.
Below is the code.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
Jobhandle=DSAttachJob(Arg1,DSJ.ERRNONE)
Ans=DSGetJobInfo(Jobhandle,DSJ.JOBSTATUS)
And then I am trying to call this Routine inside a transformer using the Code below:

Code: Select all

GetJobStatusRoutine(TRIM(svJOBNAME))
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Let's not worry about what you are doing at the moment, let's start with asking what exactly are you trying to accomplish? Your routine will need to do more than simply attach to something and won't need a handle if the "svJOBNAME" value is the current job calling the routine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

Craig,

My requirement is to get all the information about a Job.
For example, Job Name, Row Count, Start Time, End Time, Status, etc.

It is basically an Audit Process which will get information about all the Jobs.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... so there's more to come with the routine. I'm guessing the JOBNAME value you passed in is not valid or is not in the current project, which is why the handle attach failed. Add some helpful DSLogInfo() debug messages until you get it all working.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

Craig,

It is working now. It was a silly mistake.
The problem was that svJOBNAME stage Variable was not creating correct Job Name.
Thanks for the help.

Hurray!!!! :lol:
Post Reply