Re: how to change Routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Re: how to change Routine

Post by marpadga18 »

I have 1 rotuine which is working fine with below functionality
The Routine will work only if the job contains 1 input and 1 output

But I have a job which has reject link it is rejecting records to a file but job is getting aboted due to this reason

UK_LOAD..AfterJob (fatal error from 1): The records did not match with the Input and Output or Actual Threshold value is greater than Threshold value

the rotuine has reject functionality but I facing problem how to enable routine and no idea were to change it.

I am not able to change the routine for the reject functionality which it has but ...below is the routine
This Generic Routine will work only if the job contains 1 input and 1 output and if there are more links in the job please follow the below steps

1>Take a copy of this generic routine.
2>Rename it as per the job requirement as Reconciliation2in1reject1out,Reconciliation3in1reject1out....etc
3>Update the renamed routine as per your requirement.
4>Save the changes.
5>Compile the update routine and use the same in your job.
*************************************************************
Routine Name : GenericReconciliationRoutine

* Usage : This Generic Routine will work only if the job contains 1 input and 1 output and if there are more links in the job please follow the below steps.

* Created by : xyz

*

*********************************************************************************************************************************************************

ErrorCode = 0 ; * set this to non-zero to stop the stage/job

$INCLUDE DSINCLUDE JOBCONTROL.H

iSpecThreshold = 0

*---- Start processing

strOutPath = DSGetParamInfo(DSJ.ME, "$HCP_UNIX_ROUTINE_FILEPATH", DSJ.PARAMVALUE)
iSpecThreshold = DSGetParamInfo(DSJ.ME, "JPM_EXCP_THRESH", 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)

Call DSLogInfo("Specified Threshold value : ":iSpecThreshold,DSJ.ME)

*---- Check for the Threshold

fthreshold=0

fthreshold= iReadRejCount

Call DSLogInfo("Actual Threshold value:":fthreshold,DSJ.ME)



*---- Check for the Input and output Record Count

iTotalRecordCnt = iProcessRecCount+iReadRejCount

If ((iTotalRecordCnt = iReadInputRecCount) And fthreshold <=iSpecThreshold) 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) And fthreshold <=iSpecThreshold) Then

Call DSLogInfo("The records matched with the Input and Output and also Actual Threshold value is lesser than or equal to Specified Threshold value",DSJ.ME)

End Else

Call DSLogFatal ("The records did not match with the Input and Output or Actual Threshold value is greater than Threshold value",DSJ.ME)

End

*---- Check for Zero Reject Record count

if iReadRejCount<=0 then

Call DSLogInfo("No 'Reject Records' are present",DSJ.ME)

End



*---- Closing the Report File

Need some inputs please
Thanks,
M
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Seems like overkill to me. Why not download ETLstats from Kim Duke's web site?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply