Enviroment Variable

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
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Enviroment Variable

Post by mchaves »

Hi there,

I am looking to find a way to automatically generate a string like YYYY-MM (current year and month) within a a job sequence and then pass it through to the jobs.

Have you guys got any idea on how to aproach this?

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

Post by chulett »

Ignoring your thread title and answering the question as asked would lead me to say - create a 'current month and year' routine that returns that value. Call it using a Routine Activity stage, the output of which can be easily passed in as a parameter value to any downstream jobs. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

If you are on 7.5.1 you will need to call your routine via the Set Variables stage rather then a routine stage. You could also put the BASIC code directly into the Set Variables stage and not use a routine but that would not be as re-usable.
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Post by mchaves »

Hi Guys,

I am currently using datastage 7.0. I have already known about the function alternative but am trying to avoid it as writing code in ds basic makes dificult the maintenance. My guess was to use environmet variable with a formula in its value but dont know how to implement it and if it's possible.

I will wait for other suggestions.

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

Post by chulett »

mchaves wrote:I have already known about the function alternative but am trying to avoid it as writing code in ds basic makes dificult the maintenance.
I'd rethink that assertation as 'writing code in ds basic' is part and parcel of working with Server jobs. Well structured and well documented code will greatly ease the maintenance issues with any product. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you're working with 7.5 you can use an expression directly in the job parameter value allocation.

Code: Select all

Oconv(@DATE, "D-YM[4,2]")
would do it. Or you could use the DS Transform

Code: Select all

MONTH.TAG(@DATE)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply