Next: DEFINE COMMAND
Up: DEFINE
Previous: DEFINE ALIAS
Contents
Index
DEFINE CHARACTER
[SIC\]DEFINE CHARACTER Var1*Lvar1[DIM1] [...]
[SIC\]DEFINE CHARACTER*Length Var1[DIM1] [...]
CHARACTER variables can be scalar or multi-dimensional. The length of
CHARACTER variable is specified after an * either after CHARACTER key-
word or after the name of the variable. When both are present, the per-
variable length has precedence. The dimension field (same syntax as for
other arrays) should follow the length declaration. The CHARACTER key-
word can be abbreviated, i.e. this is a valid statement
DEFIN CHAR*12 Var1 Var2*36 Var3[16]
Character substrings can be accessed for reading and writing with the
[charmin:charmax] specification, e.g.
DEFINE CHARACTER C*128
LET C[3:4] "AB"
EXAMINE C[3:4]
IF C[3:4].EQ."AB" SAY "Yes"
The substring specification MUST be provided with the column ":", even
for a single character, e.g. C[1:1]. If the character variable has one
or more dimensions, the substring specification can be applied to a
scalar subarray, e.g.
DEFINE CHARACTER*128 D[3,4]
EXAMINE D[1,2][3:4]
It is an error to apply a substring specification to an array, e.g.
EXAMINE D[1,][3:4] ! Invalid
Gildas manager
2024-03-29