Problem with Date stored in Shared container

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
pmadhavi
Charter Member
Charter Member
Posts: 92
Joined: Fri Jan 27, 2006 2:54 pm

Problem with Date stored in Shared container

Post by pmadhavi »

Hi
I have a shared container attached to the taget DRS which has the latest timestamp stored.
the creteria given in source is to get the records which have timestamp greater than the timestamp stored in the shared container.
During the initial run as there wont be any data stored in date column of shared container, it is not satisfying the condition data is not loaded in the target.
pls suggest me what to do for the initial load
Last edited by pmadhavi on Tue Feb 07, 2006 4:10 pm, edited 1 time in total.
Thanks,
Madhavi
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Can you put in a condition into your transform stage output derivation for this value which tests for a null or notfound?
sun rays
Charter Member
Charter Member
Posts: 57
Joined: Wed Jun 08, 2005 3:35 pm
Location: Denver, CO

Re: Problem with Date in Shared container

Post by sun rays »

pmadhavi wrote:Hi
I have a shared container attached to the taget DRS which has the latest timestamp stored.
the creteria given in source is to get the records which have timestamp greater than the timestamp stored in the shared container.
During the initial run as there wont be any data stored in date column of shared container, it is not satisfying the condition data is not loaded in the target.
pls suggest me what to do for the initial load
how does your source know, what value is stored in your shared container? Are you passing/using some parameters?
Also could you tell us , what is in your shared container? Are you writing it to a hash file in the shared container?
pmadhavi
Charter Member
Charter Member
Posts: 92
Joined: Fri Jan 27, 2006 2:54 pm

Re: Problem with Date in Shared container

Post by pmadhavi »

sun rays wrote:
pmadhavi wrote:Hi
I have a shared container attached to the taget DRS which has the latest timestamp stored.
the creteria given in source is to get the records which have timestamp greater than the timestamp stored in the shared container.
During the initial run as there wont be any data stored in date column of shared container, it is not satisfying the condition data is not loaded in the target.
pls suggest me what to do for the initial load
how does your source know, what value is stored in your shared container? Are you passing/using some parameters?
Also could you tell us , what is in your shared container? Are you writing it to a hash file in the shared container?
The last modified date is stored in the shared container.
We have a where clause in the source DRS as
Dttm_stamp_sec> %datetimein(#LastModifiedDateTime#)

I need to convert the date of %datetimein(#LastModifiedDateTime#)
to 'yyyy-mm-dd hh:mm:ss' format
As i am not able to do it, we are getting error at the first stage itself.

Pls guide me
Thanks,
Madhavi
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Re: Problem with Date in Shared container

Post by loveojha2 »

pmadhavi wrote: The last modified date is stored in the shared container.
We have a where clause in the source DRS as
Dttm_stamp_sec> %datetimein(#LastModifiedDateTime#)

I need to convert the date of %datetimein(#LastModifiedDateTime#)
to 'yyyy-mm-dd hh:mm:ss' format
As i am not able to do it, we are getting error at the first stage itself.

Pls guide me
How are you running your job? Are you running it directly (server job) or through a sequence?

What value you are passing in #LastModifiedDateTime# parameter?
Even if it is '' then also it works well (SQL server)..
Success consists of getting up just one more time than you fall.
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

How you are taking date stored in a Hashed file. If you are fetching the date through a routine, write the logic in the routine itself. I hope you will be storing the Date in the Hashed file with Jobname.

So while reading the Hashed file for fetching the date, Just check if an entry for the jobname is there already, If it is there pass it as a output else pass the default value (1900-01-01 00:00:00) as Output.

Now you will get matching records and your job will run for the Initial load.

For converting Date to the Specified format also, you can write the logic in the routine itself.

Code: Select all

     MaxVal= "You date" (Something like 1900-01-01 00:00:00) 
      Temp1 = LEFT(MaxVal,10)
      Temp2 = RIGHT(MaxVal,8)

      MaxDate = OCONV(Temp1 , "D-YMD[4,2,2]")
      MaxTime = OCONV(Temp2 , "MTS")


      Ans = MaxDate:" ":MaxTime
Rgds
Anand
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Hey Anand as I said it would work well even with %datetimein('').
No need for going into Routine.

In fact

Code: Select all

%DateTimeIn('0000-00-00 00:00:00') > %DateTimeIn('')
is true.

So it is sure to run for all the rows (Initially), if it is coming as ''.
Success consists of getting up just one more time than you fall.
sun rays
Charter Member
Charter Member
Posts: 57
Joined: Wed Jun 08, 2005 3:35 pm
Location: Denver, CO

Re: Problem with Date in Shared container

Post by sun rays »

="pmadhavi
The last modified date is stored in the shared container.
We have a where clause in the source DRS as
Dttm_stamp_sec> %datetimein(#LastModifiedDateTime#)

I need to convert the date of %datetimein(#LastModifiedDateTime#)
to 'yyyy-mm-dd hh:mm:ss' format
As i am not able to do it, we are getting error at the first stage itself.

Pls guide me
I am sure , you must be using a Job sequence to accomplish this.
The first step might be to use a routine to get the date from the hash file.
The next step would be to send this return value as a parameter to the actual job that is reading the source table.
If this is the scenario then you can just go the job Activity(job that is reading the source table) in your job Sequence, right click and go to properties. Here you would be seeing the parameters that are passed to the job activity, change the value of the parameter to some default date or any date less than the Minimum date of your source table.
This would actually avoid any modifications to the where clause, or the routine itself.
For this you need to include the date parameter in your job parameters in your Job Sequence.
Last edited by sun rays on Wed Feb 08, 2006 12:18 pm, edited 3 times in total.
sun rays
Charter Member
Charter Member
Posts: 57
Joined: Wed Jun 08, 2005 3:35 pm
Location: Denver, CO

Re: Problem with Date in Shared container

Post by sun rays »

Forgot to mention !
After your first run, you need to change the properties of the job activity in you job Sequence.
The value for the date parameter must be the return value of your routine.
Let us know if this works.
Post Reply