Programatically Assign Paramtrs to Sequencers

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
jeredleo
Participant
Posts: 74
Joined: Thu Jun 19, 2003 8:49 am

Programatically Assign Paramtrs to Sequencers

Post by jeredleo »

I need to create a master sequencer that 1)based on different criteria calculates different selection dates for 5 sequencers within this master sequencer and 2) assign these selection dates to each of the 5 job's parameters. What is the best way to go about this? Can this be programmed in a routine or does it need to be in the job control?

Thanks for your help,
JB
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Hi JB,

In a sequence you have normaly numers adding each time a 1 to the sequence after asking the sequence. It is a good mean and often used to control datawarehouse-loading-jobs with DataStage.

An other mean instead of sequences is to use dates instead for to have a control criteria.

Both means are use in ETL-jobs.

I don't understand, what you mean with date-sequence?

A date should normaly be something related to the actual date. So I don't see any sence asking on 1st of January a sequence for 1st of January and when the next job runs on 5th february to request 2nd january from this sequence.

What does make sence is to ask relative to the actual date, what is the first day of last month, the last day of last month, the last day of next month, the last working day of next month. The 7th working day of next month and so on.

This can be done by routine, whether this routine gets a given date as input or the actual date.

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

Post by ray.wurlod »

It can be done in a Routine, but it is needed in the job control code, which would therefore have to call the Routine. User-written routines are catalogued by DataStage with a "DSU." prefix so, to invoke such a routine as a function, your job control code would need a DEFFUN declaration providing the correct number of argument placeholders and the correct Catalog name. For example:
DEFFUN NextSeqNo(SeqType) Calling "DSU.NextSeqNo"
It may be cleaner simply to place the sequence-generating code directly within the job control code.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
sankar18
Participant
Posts: 34
Joined: Mon Dec 16, 2002 1:18 am

Post by sankar18 »

Hi,

you can do it in the Job Control code itself as Ray suggest.
You can pass parameters from the Job Control code to other attached jobs in the job control code.

with regards,
T Sankar
jeredleo
Participant
Posts: 74
Joined: Thu Jun 19, 2003 8:49 am

Post by jeredleo »

I need to calculate a beginning and ending selection date for records. The selection dates are different within 5 different sequncer jobs. I have a master sequncer that needs to calculate the selection dates AND THEN assign the appropriate selection dates to Job parameters set up in the sequencers. That is what I am trying to accomplish. Based on the postings I believe I can create a routine to do my calculations and then use Job control to call the routine and assign the results to the appropriate job parameters. Let me know if this is incorrect.

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

Post by ray.wurlod »

What you propose to do can be achieved in the way you suggest; the difficulty is returning the result of the call to the sequencer. Possibilities include:
(a) since the sequencer itself is a routine (a job control routine) copy the code to a new job as job control code, then edit that code to incorporate the date generation logic
(b) have the parameter setting expression invoke your Routine
(c) pass results back through the user status area for the sequencer job
(d) write the generated dates into a hashed file and use the Trans() function to load parameter values into child jobs
Ultimately, you need to have values available in the sequencer, or in a job control routine based on sequencer code, to load into parameters of the controlled jobs.
Post Reply