Problem in using DS Routine
Moderators: chulett, rschirm, roy
Problem in using DS Routine
I am developing a server job (say Job1).Now in its Trasnformer stage derivation if I use a Routine (written by me) :
MyGetLinkCount(<Job2>,<Stage2>,<Link2>)
It is not creating any value for that derivation in output file,though the routine when tested from outside with the same arguments returns value.
Job2,Stage2,Link2 are pre-developed.
MyGetLinkCount(<Job2>,<Stage2>,<Link2>)
It is not creating any value for that derivation in output file,though the routine when tested from outside with the same arguments returns value.
Job2,Stage2,Link2 are pre-developed.
Re: Problem in using DS Routine
Do you mind putting that routine over here so that we can have a look what you are trying to do?aaikat wrote:I am developing a server job (say Job1).Now in its Trasnformer stage derivation if I use a Routine (written by me) :
MyGetLinkCount(<Job2>,<Stage2>,<Link2>)
It is not creating any value for that derivation in output file,though the routine when tested from outside with the same arguments returns value.
Job2,Stage2,Link2 are pre-developed.
It just calculates the count associated with any link. Here it is (MyGetLinkCount) :
$INCLUDE DSINCLUDE JOBCONTROL.H
hJob=DSAttachJob(JobName,DSJ.ERRFATAL)
If NOT(hJob) Then
Call DSLogFatal("Job Attach Failed", "JobControl")
Abort
End
LinkCount = DSGetLinkInfo(hJob,StageName,LinkName,DSJ.LINKROWCOUNT)
Ans = 0
If LinkCount > 0 Then
Ans = LinkCount
End
Now when I am calling that from a Transformer stage derivation like :
MyGetLinkCount("TESTAA0005","Transformer_16","DSLink11")
I dont get any output value.However I got the value while testing it from outside with the same arguments.
$INCLUDE DSINCLUDE JOBCONTROL.H
hJob=DSAttachJob(JobName,DSJ.ERRFATAL)
If NOT(hJob) Then
Call DSLogFatal("Job Attach Failed", "JobControl")
Abort
End
LinkCount = DSGetLinkInfo(hJob,StageName,LinkName,DSJ.LINKROWCOUNT)
Ans = 0
If LinkCount > 0 Then
Ans = LinkCount
End
Now when I am calling that from a Transformer stage derivation like :
MyGetLinkCount("TESTAA0005","Transformer_16","DSLink11")
I dont get any output value.However I got the value while testing it from outside with the same arguments.
Add a DSLogInfo() call to your routine that echos the input parameters, and then test that in the manager. Also, a job cannot attach to itself so if your routine gets passed the name of the actual job it will not return a value (in some versions it will hang for 30 minutes before returning nothing!). You can avoid that problem with a
Code: Select all
IF DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)#JobName THEN hJob = DSJ.ME
ELSE hJob=DSAttachJob(JobName,DSJ.ERRFATAL)
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
The job name I am passing as an argument is different from the one I am working with.
When I put 'DSLogInfo' in the routine code, the message gets shown in Director Log,but the job seems to be hung up(running for long time).The control is not returning (for a small job which does almost nothing other than calculating those routine calls.)
When I put 'DSLogInfo' in the routine code, the message gets shown in Director Log,but the job seems to be hung up(running for long time).The control is not returning (for a small job which does almost nothing other than calculating those routine calls.)
Of course you can. Just recognize the fact that it will be called for every row processed. What does yor job process, by the way... a series of job / stage / link names? Any chance one of the jobs it is trying to attach to is itself? That can hang the job.aaikat wrote:What I dbout whether we can call a routine in the derivation of a Transformer stage.
No, that's built it - but I would suggest you add a call to DSDetachJob in there.aaikat also wrote:Do I need to explicitly return the control from routine.
I always wonder why people add things like that in their posts sometimes. Isn't that the whole point of coming here? Do people think we won't?Lastly, aaikat wrote:Please help.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
You can call a routine from a transform stage. The DSAttachJob() call is pretty slow, so that might bring your rows/second speed down into the single digits. The call to DSLogInfo() is not your problem, that will not cause the delay you mentioned.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
At least put in some DSLogInfo() calls to show you at whichstatement in your routine the execution is being delayed.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Routine : MyGetLinkCount(JobName,StageName,LinkName)
Code is :
$INCLUDE DSINCLUDE JOBCONTROL.H
Call DSLogInfo("Inside Routine - Before Attach","Routine")
hJob=DSAttachJob(JobName,DSJ.ERRFATAL)
If NOT(hJob) Then
Call DSLogFatal("Job Attach Failed", "JobControl")
Abort
End
Call DSLogInfo("Inside Routine - After Attach before Get Link","Routine")
LinkCount = DSGetLinkInfo(hJob,StageName,LinkName,DSJ.LINKROWCOUNT)
Call DSLogInfo("Inside Routine - After Get Link","Routine")
Ans = 0
If LinkCount > 0 Then
Ans = LinkCount
End
I get upto this line in Log :
"Inside Routine - Before Attach"
which means DSAttachJob call is making it hung up.
Code is :
$INCLUDE DSINCLUDE JOBCONTROL.H
Call DSLogInfo("Inside Routine - Before Attach","Routine")
hJob=DSAttachJob(JobName,DSJ.ERRFATAL)
If NOT(hJob) Then
Call DSLogFatal("Job Attach Failed", "JobControl")
Abort
End
Call DSLogInfo("Inside Routine - After Attach before Get Link","Routine")
LinkCount = DSGetLinkInfo(hJob,StageName,LinkName,DSJ.LINKROWCOUNT)
Call DSLogInfo("Inside Routine - After Get Link","Routine")
Ans = 0
If LinkCount > 0 Then
Ans = LinkCount
End
I get upto this line in Log :
"Inside Routine - Before Attach"
which means DSAttachJob call is making it hung up.
Echo your input variables as well.
Code: Select all
CALL DSLogInfo('Routine input variableJobName is "':JobName:'"','')
CALL DSLogInfo('Routine input variableStageName is "':StageName:'"','')
CALL DSLogInfo('Routine input variableLinkName is "':LinkName:'"','')
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can not attach an already-running job if that job is already attached to another process (such as a job sequence). That might explain a hang on DSAttachJob().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.