Steps to create a simple server routine which can be used in many ways to get the link counts of Datastage jobs. It's very helpful for designing ETL batch with the feature of capturing operational stats.
1) Create new server routine and select Type as Transform Function
2) Go to argument tab and define 3 arguments as below -
3) Go to Code tab and paste following code : -
#Include DSINCLUDE JOBCONTROL.H
Ans = 0
JOB_HAN = DSAttachJob(JobName,DSJ.ERRWARN)
Lnk_Cnt = DSGetLinkInfo(JOB_HAN,StageName,LinkName,DSJ.LINKROWCOUNT)
JOB = DSDetachJob(JOB_HAN)
Ans = Lnk_Cnt
Return(Ans)
4) This routine can be used in many ways , for example -
In Transformer derivations
By using Routine Activity in sequencer
By using routine while passing parameters to an Activity in sequencer ... etc
1) Create new server routine and select Type as Transform Function
2) Go to argument tab and define 3 arguments as below -
3) Go to Code tab and paste following code : -
#Include DSINCLUDE JOBCONTROL.H
Ans = 0
JOB_HAN = DSAttachJob(JobName,DSJ.ERRWARN)
Lnk_Cnt = DSGetLinkInfo(JOB_HAN,StageName,LinkName,DSJ.LINKROWCOUNT)
JOB = DSDetachJob(JOB_HAN)
Ans = Lnk_Cnt
Return(Ans)
4) This routine can be used in many ways , for example -
In Transformer derivations
By using Routine Activity in sequencer
By using routine while passing parameters to an Activity in sequencer ... etc