SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Global Variable

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Global Variable
Author Message
David R. Murray



Joined: 20 Sep 2005
Posts: 2

Post Global Variable Reply with quote

We have a need to set a global variable across a number of tasks. For example, when running queries against a database. Currently each job needs to have it own connect value set via hard coded. If the connection string changes, I then have to change each task. Is there a way to set a global value that will store the value once and then call the variable for each job?

Fri Feb 17, 2006 4:06 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: Global Variable Reply with quote

The best way to deal with that is to use database profiles instead of direct connections. You make a change in one place and viola all jobs use the new settings.

Regarding your question: if you need global variables, you can define them as
Dim Global.myVariable, string

For example you can define a script job running on the scheduler startup with a code like

Dim GLOBAL.connectString, string, "my connect string"

Then in all dependent jobs use it like

DatabaseConnectEx "O81 Oracle 8i-9i", GLOBAL.connectString, ....

Please note that that global variables are not accessible in detached jobs, while it is recommended that all database jobs set to run detached.

The solution for that case is to storing "global" values in some file or registry and then reading it from there. See examples for IniFileGetKey help topic (press the examples button when that topic is open in the help system).

: We have a need to set a global variable across a number of tasks. For
: example, when running queries against a database. Currently each job needs
: to have it own connect value set via hard coded. If the connection string
: changes, I then have to change each task. Is there a way to set a global
: value that will store the value once and then call the variable for each
: job?

Fri Feb 17, 2006 5:22 pm View user's profile Send private message
waqas shahbaz



Joined: 04 Jul 2006
Posts: 1

Post Re: Global Variable Reply with quote

Dear David,

I have a question regarding GV that

How we justify the need of the scope resolution oper-
ator for accessing Global Variables.

Thanx for your time sharing with me
Regards
Waqas Shahbaz

: We have a need to set a global variable across a number of tasks. For
: example, when running queries against a database. Currently each job needs
: to have it own connect value set via hard coded. If the connection string
: changes, I then have to change each task. Is there a way to set a global
: value that will store the value once and then call the variable for each
: job?

Tue Jul 04, 2006 8:22 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: Global Variable Reply with quote

In JAL scripts you need to prefix variable name with a GLOBAL. keyword. See examples below

// this is local variable whose scope is limited to this job instance only
Dim myVariable string
// assign some value
Set myVariable, "local value"

// this is global variable whose scope is global ant is accessible from all JAL scripts, from all jobs and noitification actions
Dim GLOBAL.myGlobalVariable string
// assign some value
Set GLOBAL.myGlobalVariable, "global value"

: Dear David,

: I have a question regarding GV that

: How we justify the need of the scope resolution oper-
: ator for accessing Global Variables.

: Thanx for your time sharing with me
: Regards
: Waqas Shahbaz

Tue Jul 04, 2006 8:25 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.