Environmental variable setting

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
fk4u
Participant
Posts: 30
Joined: Fri May 12, 2006 12:38 am

Environmental variable setting

Post by fk4u »

Hello There.
I want to automate my environmental variables.
we are going to build a warehouse so we will need daily batch directory for batch processing.
We need to create a directory path on daily bases like 2006-06-02 etc.
Actually our all datafiles will be placed on business date directory and all jobs will get the source files from that directory.
So how to set the value automatically so that the directory path will be automatically set to current business date.
DSParams file in projects directory shows all the values defined. But it is static. I need that the value of date should change on next business day.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Many ways to do this. What is your overall scheduling mechanism? For example, we use Control-M and it provides the current 'Business Day' as a job parameter. Or a job / script could query the system and set the environment variable accordingly first off.
-craig

"You can never have too many knives" -- Logan Nine Fingers
fk4u
Participant
Posts: 30
Joined: Fri May 12, 2006 12:38 am

Post by fk4u »

Thanks for the reply.
Actually our jobs will run at midnight. I can create a file which will have business date only. We will not use the system data as business date cause may be some time our batch will not run one day and we have to run it other day.so current date is not acceptable.
I need datatstage to read that file and get the specific business date.
There is other choice. My oracle table BUS_DATE will also contain the business date so we can get the date from that table.
So can you guide me how to proceed. How datastage will get date through either way.
Any method you thik is easy.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The 'current date' certainly could be acceptable the vast majority of the time as long as you have a mechanism to override it if you need to. That's how we handle it.

There are tons of posts on reading parameter values from a flat file. Also on reading values from a DB in a DS job and passing it out via USER STATUS. The approach could also depend again on your overall control mechanism and what you are using for job control, which you didn't specify.

Are you using Sequence jobs or some other form of job control? What coordinates things overall?

'Easiest' to me sounds like something to set your 'Business Date' environment variable, as you originally mentioned, and then source it from there in the jobs that need it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You need to set your variable in your process itself. Like say for instance, one job reads the business date and populates it in a file. That file could just be a single column single row format, with just the date in it. You can also populate it in the parameter file of the second job that needs the business date and let the job pick it up from there
Reference thispost to get an idea of how to dynamically set variables.
Regards,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply