DB2 sequence implementation in datastage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
abhik05
Participant
Posts: 28
Joined: Thu Mar 08, 2012 8:31 am

DB2 sequence implementation in datastage

Post by abhik05 »

I have one db2 main query which needs to be run for day 0 to the day calculated by following db2 query(select (days(last_day(CURRENT_DATE)) - days(to_date('20120101','YYYYMMDD'))) from SYSIBM.SYSDUMMY1).

day value is passed as a parameter to the main query.

I have the one job to run the main query with this parameter as job parameter.

How I can run this job for parameter values staring from 0 (day 0) to value (calculated day from db2 query)?

Please suggest.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If what you need is to run the job multiple times for a range of parameter values, a Sequence job with the Loop stages should work. You'd have to either build a delimited list of those values or from a starting point compute the next value for a set number of iterations.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

Hi Craig
Thanks for the reply.

As per my requirement I dont know the upto which the loop has to be run as this is to be calculated run time by the query (select (days(last_day(CURRENT_DATE)) - days(to_date('20120101','YYYYMMDD'))) from SYSIBM.SYSDUMMY1). Aslo we need to pass the same to the main job also.

How I can do this?
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

bicap wrote:As per my requirement I dont know the upto which the loop has to be run as this is to be calculated run time by the query (select (days(last_day(CURRENT_DATE)) - days(to_date('20120101','YYYYMMDD'))) from SYSIBM.SYSDUMMY1). Aslo we need to pass the same to the main job also.

How I can do this?
Write a Server Routine to call the DB2 CLP with the query, and pick up the results into an Activity Variable which is then used as the loop limit.

*Edit* - although, why do you need to use DB2 to calculate the number of days? Don't you trust the DataStage server's system date?
Phil Hibbs | Capgemini
Technical Consultant
Post Reply