Global Varaibles??

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
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Global Varaibles??

Post by JDionne »

I know that I can set up a transform stage variable and I know that the job has prompts, but I need a global Variable that I can use in multiple transfrom stages. It dosent need to be a prompt, and prompts dont apear to be able to handle what I need I need a date/time stamp, and prompts seem to only handle date or time and dont like the function timedate(). How do I create a global variable?
Jim
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Re: Global Varaibles??

Post by kcbland »

Just create a job parameter (what you're calling a prompt) with a datatype of STRING.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Re: Global Varaibles??

Post by JDionne »

kcbland wrote:Just create a job parameter (what you're calling a prompt) with a datatype of STRING.
I knew there had to be an easy way to do that. Thanx
Jim
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Re: Global Varaibles??

Post by JDionne »

JDionne wrote:
kcbland wrote:Just create a job parameter (what you're calling a prompt) with a datatype of STRING.
I knew there had to be an easy way to do that. Thanx
Jim

The string command seems to handle the command timedate() as a string.
its not returning the actual date.
how do I handle that?
Jim
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
I think there are systemvariables available in transformer level that might give you what you need and even be consistant thruout transformer in the same job, just look in any derivation (right click and click on systemvariable).
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Re: Global Varaibles??

Post by kcbland »

JDionne wrote:
The string command seems to handle the command timedate() as a string.
its not returning the actual date.
how do I handle that?
Jim
How are you using the job parameter and where? Derive its value and set the parameter at runtime. Since it's STRING, you can put anything into it.

If you're attempting to do date arithmetic, then you have to use the appropriate functions to do the work.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Re: Global Varaibles??

Post by JDionne »

kcbland wrote:
JDionne wrote:
The string command seems to handle the command timedate() as a string.
its not returning the actual date.
how do I handle that?
Jim
How are you using the job parameter and where? Derive its value and set the parameter at runtime. Since it's STRING, you can put anything into it.

If you're attempting to do date arithmetic, then you have to use the appropriate functions to do the work.

I have successfully in the past set up a stage variable with the dirivation of timedate() and used that as the load date. I didnt want to create that in every transformation. I dont want to set the varaible at run time i want it to be dynamic.
hope that helps explane my trouble.
Jim
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

If your intent is to derive a value in the first transformer of a chain of transformers:

Code: Select all

xfm1 -->  xfm2 --> xfm3 -->  xfm4 --> 
then you can setup a stage variable in xfm1 to derive anything you want and add an extra column to the output link with a derivation of that stage variable (or whatever. That column should travel the length of the transformers. It's "visible" because it's part of the data stream.

If your value is static, but derived once, you're better off using a job parameter as it's a fixed value. The alternative is to derive it once in a stage variable in xfm1 and then leave it alone, but propagate it down the chain of transformers as I suggested.


I'm not really understanding what you're trying to do. You mention setting a load date value. Are you attempting to stamp all of the rows with a timestamp, like a last_update_dt column? Do you want each row stamped with the instantenous clock time or do you want all rows stamped with the initial start time of the job so that all rows have the exact same value? A clock call is a wait of time and cpu cycles, as it is not the same as the time the row is loaded into the database (this can be minutes of discrepancy depending on how long between derivation and commit). If you want all rows stamped with the same processing timestamp, your best bet is to derive once (one call to the clock) and stamp all.

If you have to stamp in multiple output links, then the propagation technique I described is simple enough. The complexity of setting up custom global variables (labeled COMMON) to which all transformers will have visibility has limitations on inter-process and buffering. I don't think you want that.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Jim, if you wrap your server job inside a sequence job you should find the setting of job parameters easier. In the job stage you can write some BASIC code to set the timestamp in the Parameters Value Expression field of the job stage. You've got more flexibility setting a parameter here than you have in the run job screen.

You can also set a parameter in a routine and call this routine from the sequence job, it can then be passed to server jobs as a parameter.
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post by JDionne »

vmcburney wrote:Jim, if you wrap your server job inside a sequence job you should find the setting of job parameters easier. In the job stage you can write some BASIC code to set the timestamp in the Parameters Value Expression field of the job stage. You've got more flexibility setting a parameter here than you have in the run job screen.

You can also set a parameter in a routine and call this routine from the sequence job, it can then be passed to server jobs as a parameter.
....Im gona have to open the training manual to figure that one out. Ill give it a go.
Jim
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Search the forum over the manual. We've been discussing job control for years, there's lots of samples.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post by JDionne »

kcbland wrote:Search the forum over the manual. We've been discussing job control for years, there's lots of samples.
Thanx Ill do it
Jim
Post Reply