Global Variable Definition

I have the custom function below called “Billing_Email_List” that read a SQL table and gets a list of email addresses of people who will be notified in a Catch script when there are errors.

$Job_Name = ‘Billing’;
$Billing_Email_Error_List = sql(‘xxxxxx’, ‘select DI_Error_List from DI_Email_Lists where DI_Job_Name = {$Job_Name}’);
return $Billing_Email_Error_List;

The Catch script below works perfect in my job … with a global variable defined called “$Billing_Error_Email_List”.

Billing_Email_List($Billing_Error_Email_List);
smtp_to($Billing_Error_Email_List, ‘**** Error ****’, ‘Log:’ , 0, 20);

Now let’s say I like to use this same Catch script in 50 other jobs and my question is … it will work if I define the global variable in each of the 50 jobs but can I somehow define that in the custom function one time and just have the code in the Catch script to handle all of it in each job?

My thinking is that if something would change like for example, the length of the global variable, then I would only have to change it in one place only in the custom function instead of all the global variable definitions in all 50+ jobs …


tvanbreukelen :netherlands: (BOB member since 2008-10-16)

Unfortunately global variables are job global, not repo global. So the only option is t reduce the number of jobs…


Werner Daehn :de: (BOB member since 2004-12-17)

Let’s talk about your example, you would expect a change in length of the variable.

Initially you defined a global variable ‘$Billing_Error_Email_List’ as varchar(50), now you
would like to change that variable length to varchar(200) for all the jobs(whereever you defined).

Then you try like this,

  1. Select the jobs(which needs to be change) and export those to a file.

  2. Open the atl file either in notepad or in textpad, search for your string along GLOBAL keyword

    GLOBAL $Billing_Error_Email_List varchar(50)

You will find an entry over there, now replace all it with GLOBAL $Billing_Error_Email_List varchar(150).

Save the .atl file and reimport it.

[b]Caveat: Make sure you should search with GLOBAL string & datatype of that variable.

Take a backup of your code before you change. [/b]

Hope this should work, let me know if you need any clarifications.


gssharma :india: (BOB member since 2006-10-30)