Page 1 of 1

Posted: Mon Apr 17, 2006 12:43 am
by ray.wurlod
Option 1 - do what you're doing in the SQL. This may need slight modification (perhaps CAST function) to make SUBSTR legal as an operand of an date arithmetic operator.

Option 2 - also select DB2 CURRENT TIMESTAMP into a third column, whose data type is TimeStamp (or whose data type is VarChar(26) and whose data element is TimeStamp). Then you can merrily perform your arithmetic directly using DataStage BASIC expression in a Transformer stage.

Posted: Mon Apr 17, 2006 8:56 am
by CAT
W've done this in the SQL while selecting in the ODBC node itself but would like to do all this using Data stage as they want to use the Datastage to the full. We can accomplish these while selecting itself but then DStage will become obsolete.


How can we write an equivalent - If statement in the Datastage. How can we get the current timestamp using the datastage functions?

Any one Please suggest, Thanks

Posted: Mon Apr 17, 2006 11:25 am
by diamondabhi
Search the forum first. As for getting the current timestamp in DataStage, one option is u can use DS Macros DSJobStartTimestamp, u can use if in the transformer stage constraint.

Posted: Mon Apr 17, 2006 1:50 pm
by DSguru2B
Like Ray has suggested, pull the timestamp into another column and use the same logic to CAT the Acct_num with the timestamp.
You will need a transformer to just filter out from your source.

Posted: Mon Apr 17, 2006 3:15 pm
by ray.wurlod
DataStage does not have "current timestamp"; it only has current time and current date. Do you want these to move along as rows are processed (in which case use Date() and Time() functions) or to remain constant for the job run (in which case use @DATE and @TIME system variables)?

You then have to convert from internal format and construct your timestamp. This can be done in stage variables.

It would be so much less work (and therefore faster) simply to select the current timestamp from the database into a third column.