Rejecting Records (Java Integration stage in DataStage)
Last updated: Mar 12, 2025
You might want to reject the records coming from an input link since the input record does not meet the requirements of your Java™ code. In this case, you might consider using a reject link in the job design and write the rejected data to this link.
When your Java code
needs to write the record to a reject link, your Java code must call the
getAssociatedRejectLink()
method
of the InputLink
interface to get an instance of
the OutputLink
associated with the input link in
the job design.Following is a list of methods provided by aOutputLink m_rejectLink = m_inputLink.getAssociatedRejectLink();
RejectRecord
interface:setErrorText()
setErrorCode()
getOfLink()
Similar to the case of writing records to an output link,
your Java code must instantiate
a
.RejectRecord
object by using the getRejectRecord()
method
of the OutputLink
interface. Your Java code must specify the InputRecord
object
to be rejected. A reject link in your job design might have the additional columns "ERRORTEXT" and "ERRORCODE". Your Java code can set the values for these additional columns by using theRejectRecord rejectRecord = m_rejectLink.getRejectRecord(inputRecord);
setErrorText()
and
the setErrorCode()
methods of the RejectRecord
interface.Finally, you can write this reject record to the corresponding reject link by using therejectRecord.setErrorText("Name field contains *"); rejectRecord.setErrorCode(123);
writeRecord(RejectRecord)
method
of the OutputLink
interface.m_rejectLink.writeRecord(rejectRecord);
Was the topic helpful?
0/1000