Timestamp

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
CAT
Participant
Posts: 3
Joined: Wed Mar 01, 2006 3:19 am
Location: OHIO

Post 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
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post 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.
Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply