CHARACTER
◄Up► ◄Contents► ◄Index► ◄Back►
─────CHARACTER──────────────────────────────────────────────────────────────
Action
Specifies the CHARACTER type for user-defined names.
Syntax
CHARACTER[*chars] vname [ [attrs] ] [*length] [(dim)][/values/]
[, vname [attrs][*length] [(dim)][/values/] ]...
The order of the <dim> and <length> parameters can be reversed.
Parameter Description
chars The length, in characters, of the items
specified in the CHARACTER statement.
vname Name of the constant, variable, or function.
Cannot be the name of a subroutine or main
program.
[attrs] A list of attributes, separated by commas.
Valid attributes are: ALIAS, ALLOCATABLE, C,
EXTERN, FAR, HUGE, NEAR, PASCAL, REFERENCE,
VALUE.
length The length, in characters, of the <vname>
immediately preceding it. This value, if
specified, overrides the length indicated
by <chars>.
dim A dimension declarator. Specifying <dim>
declares <vname> as an array.
values A list of constants to initialize <vname> to,
separated by commas.
Remarks
The name <vname> is defined for the entire program unit and cannot
be defined by any other type statement in that program unit.
An asterisk in parentheses ((*)) as a length specifier indicates
that the length is specified elsewhere. An asterisk length
specifier is allowed in:
1. Character constants defined by PARAMETER statements.
2. Formal character arguments.
3. Character functions that are defined in one program unit,
and referenced in another.
If neither <length> nor <chars> is specified, the length
defaults to one.
CHARACTER statements must precede all executable statements.
Examples
CHARACTER wt*10, city*80, ch
CHARACTER name(10)*20, eman*20(10)
CHARACTER*20 tom, dick, harry*12, tarzan, jane*34
-♦-