Page 1 of 1

Passing parameter to Oconv function

Posted: Mon Aug 16, 2010 12:00 am
by yaminids
Friends,

Is there a way to pass parameter to Oconv function?

My current assignment requires me to do the following
1) read the start_date and end_date from log table and pass them as variables to the next job
2) Select data from source based on the values provided by above step (1)
3) Update the log table to set the end_date

I used $USERSTATUS to pass the variables to second job. My question is, what would be the best way to update the log table by passing the end_date as parameter

Thanks a bunch in advance
Yamini

Posted: Mon Aug 16, 2010 2:11 am
by ArndW
How do you compute the new end_date that is to be written back to the table and how does OCONV() come into play?

Posted: Mon Aug 16, 2010 6:26 am
by chulett
Short answer is "yes" but you should answer Arnd's questions so we have a better idea what is going on.

Posted: Mon Aug 16, 2010 8:25 am
by yaminids
There are 3 jobs in the Sequence which are executed sequentially. end_date is the system date when the first job started. We would like to persist the end_date throughout the 3 jobs. In the next cycle we will use the end_date as the start_date for the jobs and so on. The jobs are executed 4-5 times a day

-Job--|| ----------- Start_date------ || End_date
Job-1|| End_date from the log table ||Get Sysdate & save it in variable DT
Job-2|| End_date from the log table|| DT
Job-3|| End_date from the log table|| DT

Both start_date and end_date will be used in the WHERE clause. After the completion of Job-3 we would like update the log table to set the end_date stored in variable DT

I thought I could use Oconv to convert the date stored in the variable before updating the log table. Is there a better way to update the table with the date value stored in a variable

Thanks
Yamini

P.S.All the dates, mentioned above, include timestamp

Posted: Tue Aug 17, 2010 12:26 am
by yaminids
Re-posting as I wasn't sure if you guys got my response
There are 3 jobs in the Sequence which are executed sequentially. end_date is the system date when the first job started. We would like to persist the end_date throughout the 3 jobs. In the next cycle we will use the end_date as the start_date for the jobs and so on. The jobs are executed 4-5 times a day

-Job--|| ----------- Start_date------ || End_date
Job-1 || End_date from the log table || Get Sysdate & save it in variable DT
Job-2 || End_date from the log table || DT
Job-3 || End_date from the log table || DT

Both start_date and end_date will be used in the WHERE clause. After the completion of Job-3 we would like update the log table to set the end_date stored in variable DT

I thought I could use Oconv to convert the date stored in the variable before updating the log table. Is there a better way to update the table with the date value stored in a variable

Thanks
Yamini

P.S. All the dates, mentioned above, include timestamp

Posted: Tue Aug 17, 2010 1:24 am
by ray.wurlod
Job1 can save the start date and end date in that job's user status area.
When the sequence requests the run of Job2, the start date and end date can be supplied from Job1's user status area ($UserStatus activity variable). Likewise Job2 can be supplied with end date from Job1's user status area ($UserStatus activity variable).

Posted: Tue Aug 17, 2010 1:38 am
by yaminids
Ray,

I was able to design the jobs to store and pass the variables using UserStatus based on the information you provided in a different post.

How can I use the end_date in Job2 to update the log table? Do I have to convert the date into DataStage internal format before updating the field in the database?

Thanks
Yamini

Posted: Tue Aug 17, 2010 2:52 am
by ray.wurlod
That depends on what stage type you're using. Use a Transformer stage to assign the value of the job parameter to a column. Apply Oconv() if appropriate.