Reading Records from Input Link (Java Integration stage in DataStage)
The InputLink
interface is an extension
of the Link
interface. It defines methods that are
used to interact with corresponding stage input link. The instances
of an InputLink
are available in the Configuration
object
that is provided as an argument of the validateConfiguration()
method.
Methods provided by Link interface
getColumn()
getColumnCount()
getColumnMetadata()
getLinkIndex()
getUserProperties()
subtractColumnList()
Methods provided by InputLink interface
GetAssociatedRejectLink()
readRecord()
By calling the
readRecord()
method of
an InputLink
interface, your Java™ code can consume a row from input link.
It returns an object that implements the InputRecord
interface.
InputRecord inputRecord = m_inputLink.readRecord();
The InputRecord
interface
is an extension of the Record
interface. It defines
methods that are used to get column data from a consumed row record.
Methods
provided by InputRecord interface
getObject()
getValue(String columnName)
getValue(int columnIndex)
The following example shows how to retrieve the value
corresponding to a given column index “i” in this record.
Object value = inputRecord.getValue(i);
You
can also retrieve the value by specifying the column name like below.Object value = inputRecord.getValue(“name”);