86
The following example defines dimension one with 10 elements (1 through 10).
Dimensions 2 and 3 are 0:0:
DIM CATS[1:10] !
Format 2: Drop Array Definition
DIM array_name[$]
An array definition will be dropped by using the DIM directive without
definitions/brackets; e.g., DIM A$ or DIM A. Issuing DIM A$[0] does not remove
the array definition from memory.
Format 3: Define Composite String
DIM var$:IOL=iolref
Use this format of the DIM directive to define a composite string variable consisting
of the fields specified in an IOList. The variable returns a string made up of the fields
you specified in the IOList. If you modify the variable (e.g., by adding a field)
ProvideX will modify the fields in the IOList. Field names in the IOList are prefixed
by the name of the variable and a dot (.); e.g.,
0010 DIM CST$:IOL=1000
1000 IOLIST NAME$,ADDR$,CITY$,ZIP
yields the string CST$ consisting of CST.NAME$, CST.ADDR$, CST.CITY$, and
CST.ZIP. Each field is separated by the SEP or delimiter in the default record
format.
You can use a CLEAR directive to reset a variable that is defined as a string template; e.g.,
p.87, IOLIST Specify Variable List, p.164, and CLEAR Reset Variables, p.53.
The following example defines PRD$ as a 36 character string consisting of
PRD.DESC$ for 30 characters and PRD.COST for 6 digits with a scale of 2 (2 implied
decimal digits):
0010 DIM PRD$:IOL=2000
2000 IOLIST DESC$:[CHR(30)],COST:[NUM(6,2)]
Format 4: Initialize String With Fill Character
DIM var$(len[,char$])[,...]
Use the DIM directive to define a string variable of a specific length. You can also use
the DIM statement to define the value of the string variable. ProvideX uses the first
character of the value you set in the char$ string as the fill character for the string
being defined.
The fill character is repeated for the length of the string, as follows:
DIM A$(5,"*") is the same as DIM A$(5,"*-") ... both yield A$="*****"