 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
LeeD
Joined: 17 May 2007 Posts: 311 Country: New Zealand |
|
Global variable scope and longevity |
|
Hi guys
I'm trying to use JAL global variables to get information between non-dependent scripts, for example date information to indicate what processing day it is, even when the processing time crosses midnight.
So for example 1 job dims and sets a current date global variable at say 6pm. Another job which runs at say 2am the next morning might use that date to check which file dates it needs to grab.
It's not working for me; 24x7 is operating as a service; in the 6pm job I dim a global boolean called global.eom which i then compare the current date to the @ml end of month macro-parameter and set to true if it is. In the 2am job then I try to use that global variable to make a decision, and it consistently fails to see the global variable claiming it is undefined. The setting job runs fine.
action job code snippet
dim( controlfile, string)
If( GLOBAL.eom, setcontrol3, setcontrol2)
setcontrol3:
Set( controlfile, "control3.txt")
GoTo checkforcontrol
etc
begin processingday job
Dim GLOBAL.procdate, string
Set GLOBAL.procdate, @T"yyyymmdd"
Dim GLOBAL.eom, boolean
IsEqual( GLOBAL.procdate, @ML"yyyymmdd", GLOBAL.eom )
Dim filename, string
Set( filename, "d:\\POC\\processingday.ini" )
Both jobs run synchronously.
The odd thing is that other operations like this seem to work? the first example works nicely....
Cheers
|
|
Sun Jun 17, 2007 9:05 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
|
|
This may happen if the jobs are setup to run detached. Detached jobs don't have access to the shared memory and that's what stops bad jobs from reaching and affecting main scheduler processes. Also job related resource leaks don't affect the scheduler processes.
You can turn off the job detached property and allow jobs to share global variables. I suggest indeed not to do that and instead use other memory independent methods for storing shared data, for example, INIFileGet and INIFileSet, RegistryKetGet and REgistryKeySet, FileSave and FileReadLine/FileReadAll, DatabaseGet and so on....
The only 2 cases when you really should use global variables are: (1) you need to reset all variables on the scheduler restart; (2) or if you run jobs concurrently on multiple systems and you need to dynamically pass data between jobs using GetRemoteVariable and SetRemoteVariable commands.
|
|
Mon Jun 18, 2007 12:10 am |
|
 |
LeeD
Joined: 17 May 2007 Posts: 311 Country: New Zealand |
|
|
|
Thank you
|
|
Mon Jun 18, 2007 12:21 am |
|
 |
LeeD
Joined: 17 May 2007 Posts: 311 Country: New Zealand |
|
|
|
Will global variables be shared between different queues?
Do they time out or anything like that?
|
|
Mon Jun 18, 2007 11:54 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
|
|
Yes, jobs running in different queues share global variables.
|
|
Tue Jun 19, 2007 1:06 am |
|
 |
|
|
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
|
|
|