Page 1 of 1

Help in fixing Errors in Routine

Posted: Wed Feb 01, 2006 12:35 am
by rcil
Hello All,
I need some help in fixing the routine.

The purpose of this routine is to know the job status, jobinfo, starttime endtime and linkcounts.

I am calling the after job routine in the same job. The code is as follows

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

JobVar=trim(field(InputArg,",",1))
StageName=field(InputArg,",",2)
LinkName=field(InputArg,",",3)

ProgramName="Testjob"
Call DSLogInfo(" JOBNAME ":JobVar, ProgramName)
Call DSLogInfo("STAGELINKS ":StageName, ProgramName)
Call DSLogInfo(" LinkName":LinkName, ProgramName)

RowCount=DSGetLinkInfo(DSJ.ME,StageName,LinkName,DSJ.LINKROWCOUNT)
Call DSLogInfo(" Number of records ":trim(RowCount),ProgramName)
ErrorCode = 0      ;* set this to non-zero to stop the stage/job
When I run this as an after job routine in the same job I am getting the output as -1 or sometimes -7. Could anyone please let me know what is wrong with this code and description of -1 and -7. What would be the best approach to know the jobinfo, status, starttime endtime and linkcounts.

thanks

Posted: Wed Feb 01, 2006 1:40 am
by ArndW
What is your "JobVar" argument value? It needs to be the result of either a DSAttachJob() call or the mnemonic constant of "DSJ.ME"

The -1 and -7 are error codes, they will be one of the possible errors documented in the DSGetJogInfo routine. I'm not at a DS system at the moment, but I'm fairly certain that -1 is the error for BADHANDLE. You can search the "{DataStageProjectPath}/include/JOBCONTROL.H" text file for -7 to get the value or read the routine call to get the list of possible errors.

Posted: Wed Feb 01, 2006 1:50 am
by srividya
Hi

I really don know much about the errors :oops:
but the routine i have writes the Jobname,Jobstatus,StartTime,EndTime to a sequential file., if this serves ur purpose

the Arguments to be passed is the "InputArg" which is the path of the sequential file to which the routine will be writing the details of the job
Hope you find it useful





[color=darkred]$INCLUDE DSINCLUDE JOBCONTROL.H


OpenSeq InputArg To FileVar Then

WriteSeq "JOBNAME,JOBSTATUS,JOBSTART,JOBEND" To FileVar Else
Call DSLogFatal("Cannot write to ":InputArg , "WriteAuditToSeqFile")
Go TO ErrorExit ;

End
Loop
ReadSeq Dummy From FileVar Else Exit ; * at end-of-file
Repeat
JobName = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
JobStatus = DSGetJobInfo(DSJ.ME,DSJ.JOBINTERIMSTATUS)
If JobStatus Matches 1
Then JobStatus="Success"
If JobStatus Matches 2
Then JobStatus="Compiledwithwarnings"
If JobStatus Matches 3
Then JobStatus="Aborted"
JobStart = DSGetJobInfo(DSJ.ME,DSJ.JOBSTARTTIMESTAMP)
JobEnd= DSGetJobInfo(DSJ.ME,DSJ.JOBLASTTIMESTAMP)

WriteSeqF JobName:",":JobStatus:",":JobStart:",": JobEnd To FileVar Else
Call DSLogFatal("Cannot write to ":InputArg , "WriteAuditToSeqFile")
GoTo ErrorExit
End
ErrorCode = 1 ;
End Else
Call DSLogFatal("Cannot open file ":InputArg , "WriteAuditToSeqFile")
GoTo ErrorExit
End
ErrorExit:
ErrorCode = 0 ;


End:[/color]

Posted: Wed Feb 01, 2006 5:59 am
by franck.dubreucq
According to the Server Job Developer's Guide, errcode -1 stands for DSJE_BADHANDLE (Invalid JobHandle) and -7 for DSJE_BADSTAGE (StageName does not refer to a
known stage in the job)

Posted: Wed Feb 01, 2006 10:46 am
by rcil
All the inputs are greatly appreciated. My special thanks to Srividay as his/her routine solved my problem.

This is the great place to get help.

thanks

Posted: Wed Feb 01, 2006 5:48 pm
by ray.wurlod

Code: Select all

Seek FileVar,0,2 Else NULL
is much, much more efficient than

Code: Select all

Loop 
ReadSeq Dummy From FileVar Else Exit ; * at end-of-file 
Repeat