Getting Sequencer name from the job name
Moderators: chulett, rschirm, roy
Getting Sequencer name from the job name
Hi Gurus,
I've a list of jobs in a sequential file.
I want to get the Sequencer name at which these list of jobs are being called.
How to achieve it by using Server routines...
Sample input & output are given below,
Input:
Job1
Job2
Job3
Job4
Output:
Job1 Seq1
Job1 Seq2
Job2 Seq1
Job3 Seq1
Job4 Seq1
Thanks in Advance...
I've a list of jobs in a sequential file.
I want to get the Sequencer name at which these list of jobs are being called.
How to achieve it by using Server routines...
Sample input & output are given below,
Input:
Job1
Job2
Job3
Job4
Output:
Job1 Seq1
Job1 Seq2
Job2 Seq1
Job3 Seq1
Job4 Seq1
Thanks in Advance...
When i try placing this value in the column derivation of my tranformerchulett wrote:Or, as noted, the DSJobController macro can be used just like a job parameter. Got a chance to look it up....
DSGetJobInfo(DSJ.ME,JobName)
I was getting -5 as output.
I was not getting the Sequencer name as output.
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
When i try placing this value in the column derivation of my tranformerchulett wrote:Or, as noted, the DSJobController macro can be used just like a job parameter. Got a chance to look it up....
DSGetJobInfo(JobName,DSJ.JOBCONTROLLER)
I was getting -1 as output.
I was not getting the Sequencer name as output.
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Could you try with the below macro and check if its working fine....chulett wrote:Did you try using the macro instead? Did you try looking up the error codes? They are documented. ...
$include DSINCLUDE JOBCONTROL.H
JobName=Arg1
JobHandle = DSAttachJob (JobName, DSJ.ERRFATAL)
controllerList=DSGetJobInfo(JobHandle,DSJ.JOBCONTROLLER)
ErrCode=DSDetachJob(JobHandle);
print controllerList;
Ans=controllerList
Thanks
Subrat
[quote="subrat]
Could you try with the below macro and check if its working fine....
$include DSINCLUDE JOBCONTROL.H
JobName=Arg1
JobHandle = DSAttachJob (JobName, DSJ.ERRFATAL)
controllerList=DSGetJobInfo(JobHandle,DSJ.JOBCONTROLLER)
ErrCode=DSDetachJob(JobHandle);
print controllerList;
Ans=controllerList
Thanks
Subrat[/quote]
Hi Subrat,
I'd included the code in a routine called GetJobStatus with one arguement Arg1.
When i run my job by calling this routine in my job by uisng the below derivation
"DSGetJobInfo(GetJobStatus(JobName), DSJobController)"
My job is getting aborted with the following error message
"ExtractJobDetails (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle Seq_Name"
I see the sequencer name was getting retrieved correctly by the fatal error message,but why it was not getting return to the target & also why my job is getting aborted.
Could you try with the below macro and check if its working fine....
$include DSINCLUDE JOBCONTROL.H
JobName=Arg1
JobHandle = DSAttachJob (JobName, DSJ.ERRFATAL)
controllerList=DSGetJobInfo(JobHandle,DSJ.JOBCONTROLLER)
ErrCode=DSDetachJob(JobHandle);
print controllerList;
Ans=controllerList
Thanks
Subrat[/quote]
Hi Subrat,
I'd included the code in a routine called GetJobStatus with one arguement Arg1.
When i run my job by calling this routine in my job by uisng the below derivation
"DSGetJobInfo(GetJobStatus(JobName), DSJobController)"
My job is getting aborted with the following error message
"ExtractJobDetails (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle Seq_Name"
I see the sequencer name was getting retrieved correctly by the fatal error message,but why it was not getting return to the target & also why my job is getting aborted.
Your syntax is bad and you need to let the routine do all the work.DSMaestro wrote:DSGetJobInfo(GetJobStatus(JobName), DSJobController)
Code: Select all
GetJobStatus(JobName)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your original question was how to do it in a routine. People have been answering that question.DSMaestro wrote:But how u call this function in server transformer....
I doubt that U (one of our posters) is interested in calling this function at all, but I could be wrong. The second person personal pronoun in English is spelled "you". Please maintain a professional standard of written English on DSXchange; this helps those whose first language is not English.
The function name is DSGetJobInfo, not GetJobInfo. In a Transformer stage you would need to use a custom routine that is passed the job name that is being read from the file and which returns the list of controller job names.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Something like the following code would appear to meet the requirement.
Code: Select all
FUNCTION GetController(JobName)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
If UnAssigned(JobName) Or (Len(JobName) = 0)
Then
Ans = @NULL
End
Else
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
Controller = DSGetJobInfo(hJob, DSJ.JOBCONTROLLER)
If Controller = DSJE.BADHANDLE
Then
ErrMsg = 'Unable to attach job ' : JobName
Call DSLogWarn(ErrMsg, 'GetController')
Ans = @NULL
End
Else
Ans = Controller
End
ErrCode = DSDetachJob(hJob)
End
RETURN(Ans)
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.