VALUE

Contents


Value is used to declare arguments of a sub-programme, specifying that they have been passed by value.

 

Syntax

   Value word_type list_var_dim

 

Parameters

Element

Description

Restrictions

word_type

One of the key words used for declarations:
Libelle, Shortint, Date, Integer, Decimal, Char.
For Char, the variable name is then followed by ().

This must be an Adonix data type.

list_var_dim

List ofvar_dim separated by the character ','.

None.

var_dim

Variable expressed in one of the following forms:
nom_var ou nom_var '(' list_sep ')'

None.

nom_var

name_of_variable.

None.

list_sep

List of ',' separations (the place normally taken by the dimensions expression stays empty, and only the number of dimensions is therefore declared).

Not more than 3 separators, since the number of dimensions is limited to 4.

 

Examples

# Declaration of Call arguments
   Subprog SOUS_TRAIT(ARGUMENT1, ARGUMENT2,   ARGUMENT3)
   Value Integer ARGUMENT1(,,) :# ARGUMENT1 is a 3-dimension table
  
Value Char ARGUMENT2()(,)   :# ARGUMENT2 is a 2-dimension table
 
 Value Date ARGUMENT3        :# ARGUMENT3 is a date (without dimension)

 

Description and comments

Value is used to declare that arguments of a sub-programme are passed by value, that is copied to a local variable created at the time of the Call. Modifications made to this variable will therefore not be assigned to variables passed in the argument of the Call instruction.

A Value command is given automatically for arguments of a sub-programme not declared in this sub-programme, when these arguments are expressions (when they are variables, a Const command is given).

If expressions are to be passed as parametres, they must be declared as Value type (not not declared at all).

 

Comment

Passing parameters by value may take time and occupy memory for large tables, since they are recopied for a Value command.

 

Associated errors

Error

Description

ERMODE (10)

Incompatibility of type between declaration of the argument and the parameter passed in the Call.

ERDIM (55)

The number of dimensions declared does not match the dimension of the variable passed in parameter.

 

Associated key words

SHORTINT - DECIMAL - CHAR - DATE - INTEGER - LIBELLE - CONST - VARIABLE - CALL - SUBPROG


CONTENTS


Copyright © Sage 1999 - 2007