I have written a simple routine to get Category for all the jobs. The Routine works fine when executed via manager.
On attaching a Routine Activity in Sequencer, the sequencer hangs but the routine does complete it's task.
The Routine Accepts no arguments and runs on the Entire Project.
It writes in a sequential file the Job Name and the Category.
Any Idea what am i missing here?
Thanks in advance,
The Routine Code is :-
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
********************************
*Initialization of Variables
*
********************************
Ans = 0
* Write it to Sequential File the Link Details with the Enter Charachter.
OpenSeq '/db2fs1/nishad/JobNamesAndCategory_temp.txt' to File_Handle Else ErrorCode = 1
Seek File_Handle,0,2
Else ErrMsg = "Unable to position to end of File"
******************************
* Getting All Jobs within Current Project
*******************************
JbLst = DSGetProjectInfo(DSJ.JOBLIST)
TotalJbCnt = Dcount(JbLst,",")
For JbCntr = 1 To TotalJbCnt
JobName = Field(JbLst,',',JbCntr)
Job_Handle = DSAttachJob(JobName,DSJ.ERRNONE)
IF Not(Job_Handle) Then Continue
Jb_Name = DSGetJobInfo(Job_Handle,DSJ.JOBNAME)
Shell = "UV"
Output = ""
ExitStatus = 0
Command = "SELECT CATEGORY FROM DS_JOBS WHERE NAME = '" : JobName : "'; "
Call DSExecute(Shell, Command, Output, ExitStatus)
Folder_Name = Ereplace(Ereplace(Ereplace(Ereplace(Output,@FM,''),'Category',''),'.',''),'1 records listed','')
WriteSeqF Jb_Name : '|' : Folder_Name To File_Handle Else Call DSLogFatal("Cannot Open File","My Routine")
ErrCd = DSDetachJob(Job_Handle)
Next JbCntr
CLOSESEQ File_Handle
Ans = ErrMsg