Job Sequencer : calculated parameter (date)

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
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Write a simple server job that retrieves the date from the Database and writes it to a text file.

Write a routine that opens the text file and reads the date and returns this date to the calling job.

In your first Sequential job run the server job that saves the date to a text file, run the routine that retrieves the date from the text file. Now link this routine output to all subsequent server jobs and pass the routine ReturnedValue to those jobs as job parameters. If your routine stage is called GetDate then the job parameter will be set to GetDate.ReturnedValue. You can type this into the parameter value box or you can pick it from the list of available parameters by clicking the parameter button. Just make sure you have a sequence of links from your GetDate stage to all the jobs that will use that date.

I know you don't want to do much coding however opening a text file and reading the first line is very easy! Just check out the sequential file commands in the DataStage programming manual or do a search for OpenSeq in the archives of this site.


Vincent McBurney
Data Integration Services
www.intramatix.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or, if you want to do even less coding (and you're on UNIX), invoke the head command through DSExecute.

head -1 filename
returns the first line of a file.

Shell = "UNIX"
Command = "head -1 " : FileName
Output = ""
StatusCode = 0
Call DSExecute(Shell, Command, Output, StatusCode)

Yet another approach (groan!) is to have a generic job or shared container that loads the job's user status area. I will dredge this out from my files and post it in the next day or two.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

Thanks for your suggestions.
Before I get your answers, I found a way to do this with a sequential file (as Vincent suggested), after what I read this date from a Job Control (not from a routine) and then from the job control, I ran the Job sequencer with the date as param.
I'll make changes to try to do it in my job sequencer using GetDate.ReturnedValue. This will be better.
Anyway, I'm interested in reading Ray post with user status area too.
Thanks.
Post Reply