DSGetLinkInfo
Use the DSGetLinkInfo function to obtain information about a link on an active stage. You can use this information generally as well as for job control. The DSGetLinkInfo function might reference either a controlled job or the current job, depending on the value of the JobHandle variable.
Syntax
Result = DSGetLinkInfo (JobHandle, StageName, LinkName, InfoType)
JobHandle is the handle for the job as derived from DSAttachJob, or it can be DSJ.ME to refer to the current job.
StageName is the name of the active stage to be interrogated. might also be DSJ.ME to refer to the current stage if necessary.
LinkName is the name of a link (input or output) attached to the stage. might also be DSJ.ME to refer to current link (for example, when used in a Transformer expression or transform function called from link code).
InfoType specifies the information required and can be one of:
DSJ.LINKLASTERR
DSJ.LINKNAME
DSJ.LINKROWCOUNT
DSJ.LINKSQLSTATE
DSJ.LINKDBMSCODE
DSJ.LINKDESC
DSJ.LINKSTAGE
DSJ.INSTROWCOUNT
DSJ.LINKEOTROWCOUNT
Result depends on the specified InfoType, as follows:
- DSJ.LINKLASTERR String - last error message (if any) reported from the link in question.
- DSJ.LINKNAME String - returns the name of the link, most useful when used with JobHandle = DSJ.ME and StageName = DSJ.ME and LinkName = DSJ.ME to discover your own name.
- DSJ.LINKROWCOUNT Integer - number of rows that have passed down a link so far.
- DSJ.LINKSQLSTATE - the SQL state for the last error occurring on this link.
- DSJ.LINKDBMSCODE - the DBMS code for the last error occurring on this link.
- DSJ.LINKDESC - description of the link.
- DSJ.LINKSTAGE - name of the stage at the other end of the link.
- DSJ.INSTROWCOUNT - comma-separated list of row counts, one per instance (parallel jobs)
- DSJ.LINKEOTROWCOUNT - row count since last EndOfTransmission block.
Result might also return error conditions as follows:
- DSJE.BADHANDLE JobHandle was invalid.
- DSJE.BADTYPE InfoType was unrecognized.
- DSJE.BADSTAGE StageName does not refer to a known stage in the job.
- DSJE.NOTINSTAGE StageName was DSJ.ME and the caller is not running within a stage.
- DSJE.BADLINK LinkName does not refer to a known link for the stage in question.
Remarks
When referring to a controlled job, DSGetLinkInfo can be used either before or after a DSRunJob has been issued. Any status returned following a successful call to DSRunJob is guaranteed to relate to that run of the job.
Example
The following command requests the number of rows that have passed down the order_feed link in the loader stage of the job qsales:
link_status = DSGetLinkInfo(qsales_handle, "loader",
→ "order_feed", DSJ.LINKROWCOUNT)