Baanboard.com

Go Back   Baanboard.com

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
17%
500 - 800 GB
6%
800 - 1200 GB
6%
1200 - 1500 GB
17%
1500 - 2000 GB
17%
> 2000 GB
22%
Total votes: 18

Baanboard at LinkedIn


Reference Content

 
Common variables
By patvdv at 26 Feb 2008 - 21:56

Common variables

Unlike other variables, which can be used only within the program in which they are declared, common variables can be used in more than one program. Only string variables can be declared as COMMON.

Common variables are automatically based on a common memory part that can be used by several programs. For this reason they must be declared as BASED. The fact that they are common must be indicated with the reserved word COMMON.

Declaration of common variables must be located outside every function. So they must be declared as global variables.

Example

In program 1 and program 2, the same memory space is used for variables com_1 and com_2.

 Within program 1:
    STRING    com_1(10) BASED, com_2(15) BASED
    COMMON    com_1, com_2
   <functions which use com_1 and com_2>

 Within program 2:
    STRING    com_1(10) BASED, com_2(15) BASED
    COMMON    com_1, com_2
   <functions which use com_1 and com_2>

As an alternative to using common variables, you can use import(), export(), get.var() and put.var() to transport the values of variables between processes.

Related topics


0
No votes yet


All times are GMT +2. The time now is 17:30.


©2001-2018 - Baanboard.com - Baanforums.com