Code: Select all
ErrorCode = 0 ; * set this to non-zero to stop the stage/job
$INCLUDE DSINCLUDE JOBCONTROL.H
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE UNIVERSE.INCLUDE ODBC.H
$ENDIF
*---- Start processing
strOutPath = DSGetParamInfo(DSJ.ME, "RP", DSJ.PARAMVALUE)
paths=DSGetParamInfo(DSJ.ME, "Patha", DSJ.PARAMVALUE)
*---- Opening the File
CntFilename = DSGetParamInfo(DSJ.ME, "JPM_ROUTINE_FILENAME", DSJ.PARAMVALUE)
strFileName = strOutPath:"/":CntFilename
*--Call DSLogInfo("Input link":strFileName,DSJ.ME)
OpenSeq strFileName To objFileVar
Else
Create objFileVar
Else
ErrorCode = 1
WeofSeq objFileVar
End
End
WeofSeq objFileVar
*---- Getting the link count for Input link
Call DSLogInfo("Input link",DSJ.ME)
iReadInputRecCount=0
InputStageName1 = DSGetParamInfo(DSJ.ME,"JPM_INPUT_STAGE", DSJ.PARAMVALUE)
InputLinkName1 = DSGetParamInfo(DSJ.ME, "JPM_INPUT_LINK", DSJ.PARAMVALUE)
iReadInputRecCount1 = DSGetLinkInfo(DSJ.ME,InputStageName1,InputLinkName1,DSJ.LINKROWCOUNT)
iReadInputRecCount=iReadInputRecCount1
*----Checking if reject link exists or not
Reject_Status = 0
Reject_Status = DSGetParamInfo(DSJ.ME, "JPM_REJECT_STATUS", DSJ.PARAMVALUE)
If(Reject_Status >0) Then
*---- Getting the link count for Reject link
Call DSLogInfo("Reject link",DSJ.ME)
iReadRejCount = 0
RejectStageName1 = DSGetParamInfo(DSJ.ME,"JPM_REJECT_STAGE1", DSJ.PARAMVALUE)
RejectLinkName1 = DSGetParamInfo(DSJ.ME, "JPM_REJECT_LINK1", DSJ.PARAMVALUE)
iReadRejCount1 = DSGetLinkInfo(DSJ.ME,RejectStageName1,RejectLinkName1,DSJ.LINKROWCOUNT)
Call DSLogInfo("Reject Link1:" : iReadRejCount1,DSJ.ME)
iReadRejCount = iReadRejCount1
End Else
iReadRejCount = 0
End
Call DSLogInfo("--------------JOB STATISTICS-------------",DSJ.ME)
Call DSLogInfo("Input Record Count :":iReadInputRecCount,DSJ.ME)
Call DSLogInfo("Reject Record Count :":iReadRejCount,DSJ.ME)
*---- Getting the required counts from the Output link
ProcessStageName= DSGetParamInfo(DSJ.ME,"JPM_OUTPUT_STAGE", DSJ.PARAMVALUE)
ProcessLinkName = DSGetParamInfo(DSJ.ME, "JPM_OUTPUT_LINK", DSJ.PARAMVALUE)
iProcessRecCount = DSGetLinkInfo(DSJ.ME,ProcessStageName,ProcessLinkName,DSJ.LINKROWCOUNT)
strRecCount = FMT(iProcessRecCount,"10L")
Call DSLogInfo("Output Record Count : " :strRecCount, DSJ.ME)
iTotalRecordCnt = iProcessRecCount+iReadRejCount
If ((iTotalRecordCnt = iReadInputRecCount) ) Then
fthresholdSts= "SUCCESS"
End Else
fthresholdSts = "FAILURE"
End
*---- Other Parameters
JobName = DSGetJobInfo (DSJ.ME, DSJ.JOBNAME)
JobStartTime = DSGetJobInfo (DSJ.ME,DSJ.JOBSTARTTIMESTAMP)
JobEndTime = DSGetJobInfo (DSJ.ME,DSJ.JOBLASTTIMESTAMP)
ProjectID = DSGetParamInfo(DSJ.ME,"$HCP_SHARP_DS_PROJ", DSJ.PARAMVALUE)
SequenceName = DSGetParamInfo(DSJ.ME,"JPM_DS_SEQ", DSJ.PARAMVALUE)
MetricDescription= DSGetParamInfo(DSJ.ME,"JPM_METRIC_DESC", DSJ.PARAMVALUE)
*---- Wrting the Reonciliation count into a file in format ProjectID,SequenceName,Job name,JobStartTime,JobEndTime,Input Records,Success records,Reject records,MetricValue,MetricDescription,Comments
strReconCount = ProjectID:',':SequenceName:',':JobName:',':FMT(JobStartTime,"20L"):',':FMT(JobEndTime,"20L"):',':FMT(iReadInputRecCount,"10L"):',':FMT(iProcessRecCount,"10L"):',':FMT(iReadRejCount,"10L"):',':fthresholdSts
WriteSeqF strReconCount To objFileVar Then
End
*---- Check for threshold and abort the job
If ((iTotalRecordCnt = iReadInputRecCount) ) Then
Call DSLogInfo("The records matched with the Input and Output and Rejects ",DSJ.ME)
End Else
Call DSLogFatal ("The records count did not match with the Input and Output and Rejects ",DSJ.ME)
End
*---- Check for Zero Reject Record count
if iReadRejCount<=0 then
Call DSLogInfo("No 'Reject Records' are present")
End
*-- Load into Database
*-- Path=C:\'Program Files'\'Microsoft SQL Server'\90\Tools\Binn
InsertStmt="INSERT INTO DATABASENAME.dbo.t values ('" : SequenceName: "');"
SQLCmd='"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\SQLCMD" -S DATABASENAME -U USERNAME -P PASSWORD -q "' : InsertStmt : '"'
Call DSExecute('NT',SQLCmd,Output,RtnCode)
PPlease check and let me knwo where i went wrong .