Ignore DSJ.BADLINK error on Server routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
leandrohmvieira
Participant
Posts: 44
Joined: Wed Sep 02, 2015 7:19 am
Location: Brasilia, Brazil

Ignore DSJ.BADLINK error on Server routine

Post by leandrohmvieira »

Greetings Experts,

I want to ETL the rowcount of my jobs , and for it we adopted a dev pattern and created an after-job routine that get the values and inserts them in a table. But when routine is executed from a job that does not have the link, the routine aborts:

LDWDim_Age..AfterJob (fatal error from DSGetLinkInfo): Job control fatal error (-9)
(DSGetLinkInfo) Unknown link INS in stage SRK of job LDWDim_Age


My code is the following:

Code: Select all

IF DSGetLinkInfo(DSJ.ME, "SRK","INS", DSJ.LINKROWCOUNT) = DSJE.BADLINK THEN 
		ErrCode = DSSetParam(hJob1, "QTD_RGT_INS", 0) 
END
ELSE 
		ErrCode = DSSetParam(hJob1, "QTD_RGT_INS",DSGetLinkInfo(DSJ.ME, "SRK","INS", DSJ.LINKROWCOUNT) )
END
To other error conditions, the routine just return me the values, but for DSJE.BADLINK it aborts.

Am i doing something wrong? I know there is other ways to check if a link exists on a job, looking into STAGE and LINK lists, but im just curious about this behavior, would be much more easy to just take error code just like other errors...

Thanks in advance.
Leandro Vieira

Data Expert - Brasilia, Brazil
leandrohmvieira
Participant
Posts: 44
Joined: Wed Sep 02, 2015 7:19 am
Location: Brasilia, Brazil

Post by leandrohmvieira »

I could not achieve a way to ignore this error, so i did a workaround solution, starting from JobInfo, which i have sure it exists.

Here is the code:

Code: Select all

FOR Counter = 1 TO (COUNT(ParamDef,',')+1) STEP 1

	ParamName = FIELD(ParamDef,",",Counter)
	StageName = FIELD(StageDef,",",Counter)
	LinkName = FIELD(LinkDef,",",Counter)

	StageList = ",":DSGetJobInfo (DSJ.ME, DSJ.FULLSTAGELIST):","
	IF NOT(StageList MATCH "0X,":StageName:",0X" ) THEN
		ErrCode = DSSetParam(hJob1, ParamName,0)
		CONTINUE
	END

	LinkList = ",":DSGetStageInfo (DSJ.ME,StageName,DSJ.LINKLIST):","
	IF LinkList MATCH "0X,":LinkName:",0X" THEN
		ErrCode = DSSetParam(hJob1, ParamName,DSGetLinkInfo(DSJ.ME, StageName,LinkName, DSJ.LINKROWCOUNT))
	END
	else
		ErrCode = DSSetParam(hJob1, ParamName,0)
	END
	
NEXT Counter
Leandro Vieira

Data Expert - Brasilia, Brazil
Post Reply