for (int columnNumber = 0; columnNumber < columnCount; columnNumber++)
...is going to "loop" thru as many columns as you have on that output link. You can't "add" a column, as this is at run time, but it will certainly handle as many as the developer chooses to use. It detects this at runtime but can't change it.
Describe to us what it is that you are trying to do.
No problem...just code the DataStage Job with your "extra" column that is supposed to receive the value.
You could give it a dedicated name, or always know that it is in the first position...whatever you want.
The key point I was making up above is that the output link is "fixed" at the time of compilation. There's no "adding" columns. You can populate anything you want that is on the link, but the developer of the DataStage Job will have had to put it there ....assuming that you want this "column" to be something that the DataStage Developer is going to use downstream.
Of course, your java class could also do its own I/O and do whatever it wants to with that new value.
If this isn't clear then perhaps we still aren't understanding what your goal is.
I can't teach you how to code in java...we'll leave that to some other forum somewhere, but conceptually, once you are "inside" that loop, you could look for the column that is supposed to get your value. Consider this snippet:
if (rowNumber == 1)
{
Column MetaDataForMyColumn = inputRow.getColumn(columnNumber);
String colName = MetaDataForMyColumn.getName();
int colSQLType=MetaDataForMyColumn.getSQLType();
String colSQLTypeName=Column.getSQLTypeName(colSQLType);
trace(colName);
trace(colSQLTypeName);
}
//*--------------------------------------------------------------------------------------------------------------
// "reject" any rows that have asterisks [these will go down a link that the DS developer marks as "reject" link
//*--------------------------------------------------------------------------------------------------------------
outColNumber=columnNumber;
if (value.indexOf("*") >=0) {
reject = true;
// warn("Value found with Asterisk. Reject the row");
outputRow.setValueAsString(outColNumber, value);
} else {
outputRow.setValueAsString(outColNumber, value.toUpperCase());
}
}
Note at the top how I am pulling out the column name and its datatype. I'm not doing anything with those values, but I certainly could have. Later on in the code, I check to see if the value of the current column (current meaning the index value of the loop that I am on) contains an asterisk. In your case you might want to look for this "special" column name and then you would write this "special value" that you have (setting the value on the output row) at that particular time, as opposed to writing something else.