CHAR

Contents


Char is used to declare character string variables.

 

Syntax

   Char        list_chr_dim
   Local  Char list_chr_dim
   Global Char list_chr_dim
   Extern Char list_chr_dim

 

Parameters

Element

Description

Restrictions

list_chr_dim

List ofchr_dim separated by the
character ','.

None.

chr_dim

Name of a variable expressed in
one of the following forms:
nom'(' maxlen ')'
nom'(' maxlen ')' '(' lis_dim ')'

None.

nom

nom_de_variable.

None

maxlen

Maximum permitted length for
the character string concerned.

Integer expression
between 1 and MAXSTR
(255).

lis_dim

List of exp_dim separated by the
character ','.

Number limited to 4.

exp_dim

Integer expression representing
the number of elements of the
variable (from 0 to exp_dim-1)
or
2 integer expressions separated
by the 2 characters '..'
representing the range of
possible indices for the variable

The number of elements
must belong
to [1,65535]. If
a range is
given the starting
index must
belong to
[-32768,32767].

 

Examples

# Declaration of an external table of 8 strings of 5 characters
# max (numbered 0 to 7)
   
Extern Char TABLIB (5)(8)

# Declaration of a table of 8 strings of 1 character,
# the elements being numbered from I to I+7)
  
  I = 3
  
Char TABLIB(1)( I .. I+7 )
  
Char MES(80)        : # Declaration of a string of 80 characters
   Date DTE           : # Declaration of a Date type variable
   DTE = [9/10/1992]: # Allocation of a Date type constant

  # Calculation of message to be displayed.
     
MES = "Today is "+day$(DTE)+" "+num$(day(DTE))+" "
   MES += month$(DTE)+" "+num$(year(DTE)
)
   # Displays the following message:
# Today is Friday 9 October 1992
 
  Infbox MES

# Declaration of a 4-dimensional matrix of 10-character strings
  
Char MAT(10)(I, J, K, L)

 

Description and comments

Char is used to declare character string type variables, scaling them if necessary.

If the number of characters in the string is not shown, the chain is created with a maximum length of 30 characters.

If Local is used, the variables will be local to the routine or sub-programme and deleted when the sub-programme or routine is completed.

If Extern is used, the variable is not created, but its existence and type are checked.

If Extern is not used, a declaration of a variable already existing in class [V] or [L] will cause this variable to be deleted, followed by its recreation with the dimensions and type given. After a declaration, the variable is always initialised (that is, set to "" for a variable of type Charfor all indices of the variable).

 

Associated errors

Error

Description

ERDIM (55)

Too many dimensions are given (>4).

ERVARI ( 6)

Non-existent variable (Extern).

ERMODE (10)

- The dimensions given are not numerical.
- The type of variable is incorrect (Extern).

ERINDI ( 8)

One of the dimensions is null.

ERDOM (50)

- The dimensions are not between -32768 and +32767.
- The number of characters required is negative or more than MAXSTR (255).

 

Associated key words

LIBELLE - SHORTINT - DATE - INTEGER - DECIMAL - TYPE - DIM - GLOBAL - LOCAL - EXTERN


CONTENTS


Copyright © Sage 1999 - 2007