Page 1 of 1

Enviroment Variable

Posted: Tue Dec 20, 2005 6:37 pm
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

Posted: Tue Dec 20, 2005 7:05 pm
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:

Posted: Tue Dec 20, 2005 8:44 pm
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.

Posted: Tue Dec 20, 2005 9:05 pm
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

Posted: Tue Dec 20, 2005 10:32 pm
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:

Posted: Wed Dec 21, 2005 1:33 am
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)