Question on Extraction

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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Question on Extraction

Post by cosec »

I have a job that extracts from certain table based on the current date and loads it on to a table.

sample:

select A.aaa,A.bbb from table A
where current date = date(send_dttm) + 2 days;

Last night my job started at 23.45 pm and finished at 00.15 this morning.


I have checked my extraction and loading and as expected it has been done using the current date as yesterday(2008-01-23).

Will there be a possibility that the current date will be used as 2008-01-24 when the extraction goes over to the next day ??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That would depend entirely on how you specify "current date" and how the database server handles that. For example, if you specify it as "job start date" then there's no way it can carry over.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

ray.wurlod wrote:That would depend entirely on how you specify "current date" and how the database server handles that. For example, if you specify it as "job start date" then there's no way it can carry over. ...
The current Date is specified as I had given in the sample above.

So in the DB2 stage SQL portion how do I replace the current date with the DSJobstartDate ??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create a job parameter called, say, jpRunDate. Assign its value from a job sequence that generates the appropriate value, whether from a function, a macro, or whatever. Use a reference to this parameter instead of current date in your WHERE clause.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

"Goes over to the next day"? :?

Current date is current date and simply running over midnight doesn't change the value of the 'current date' when the the query started, which is when it would be evaluated. Of course, if you start after midnight, then of course it will use the 'next' date.
-craig

"You can never have too many knives" -- Logan Nine Fingers
SHARAD123
Premium Member
Premium Member
Posts: 54
Joined: Wed Jan 09, 2008 12:05 am

Post by SHARAD123 »

Hi,
It ll be better to create a temporary table holding the info for the current run. So that whatever changes u can retrieve it from the temporary table.

Note: Everytime you run jus truncate the temporary table and re-run it so that oly the current details will be there in the table
222102
SHARAD123
Premium Member
Premium Member
Posts: 54
Joined: Wed Jan 09, 2008 12:05 am

Post by SHARAD123 »

Hi,
It ll be better to create a temporary table holding the info for the current run. So that whatever changes u can retrieve it from the temporary table.

Note: Everytime you run jus truncate the temporary table and re-run it so that oly the current details will be there in the table
222102
Post Reply