Go Back

User login

Frontpage Sponsor


Google search

For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
Installation Wizard into new VRC
Manual into existing VRC
Manual into new VRC
Total votes: 43

Baanboard at LinkedIn

Reference Content

Fixed and based variables
By patvdv at 26 Feb 2008 - 21:56

Fixed and based variables

Fixed variables

A string variable can be declared as fixed so that its current length always equals the maximum length. For example:

 STRING name(10)  FIXED
 name = "andrew"              | the string is always filled up with spaces

The keyword FIXED is applicable to one-dimensional strings only. Multi-dimensional string arrays are always fixed and do not need to be declared with the keyword FIXED.

Based variables

The BASED mechanism is applicable to strings or arrays of all possible types. It determines that a variable will be based on another variable. For based variables, no memory space is reserved when they are declared. At runtime they use the same memory space as the variable on which they are based. So by using this mechanism, the same section of memory can be accessed via different names.

You use the following construction to base one variable on another:

BASE var_1 AT var_2

In the case of a string, the based variable is always fixed. You must ensure that the based variable always fits in the variable on which it is based. So it will be safe to declare the basic variable as FIXED.


 STRING a(10)      FIXED
 STRING b(5)       BASED
 BASE b AT a(3)                | This indicates that the space occupied
                                         | by b is the same as the space for a(3;5)
 b(2;3) = "yes"                | a(4;3) now also contains "yes"
 a(1;8) = "12345678"       | b now contains "34567"

Variable and fixed length strings

The following points summarize the rules for variable and fixed length strings:

  • Strings with variable length are 1-dimensional strings not declared as based or fixed. All other strings are fixed- that is, database table fields, string arrays, and variables declared as FIXED or BASED.
  • Normally, variable length strings are not filled up with spaces except when a start position is specified in the assignment.
  • Fixed length strings are always filled up with spaces, except when a length is specified. In the latter case, the remaining positions are not overwritten by spaces.
  • If a string (of variable or fixed length) is filled from a certain start position, the part of that string preceding the start position is filled up with spaces if it was not filled before.

Related topics

No votes yet

All times are GMT +2. The time now is 10:04.

©2001-2017 - -