[Coco] Using the Basic09 type statement. CORRECTION

L. Curtis Boyle curtisboyle at sasktel.net
Sun Apr 4 13:35:56 EDT 2021


You can combine multiple variables onto single type lines, which should help. Also, you have aline DIM’d as a single variable, not an array.
So you many want to do something like:
TYPE page=ahead:STRING[21];aline(6):STRING[17]
DIM apage:page

Then you should be able to do things like:
apage.ahead=“This is the Header field of the page"
apage.aline(1)="This is line ONE of the page."

You can even make multiple pages:
DIM page(10):page

apage(1).ahead=“This is the header for page 1”
apage(2).ahead=“This is the header for page 2”
apage(2).aline(3)=“This is line 3 for page 2”


L. Curtis Boyle
curtisboyle at sasktel.net



> On Apr 4, 2021, at 8:01 AM, coco at jechar.ca wrote:
> 
> Ignore original code. Equal signe were missing from three lines.
> Program still has issues though.
> 
> Revised Code
> 
> PROCEDURE ttype
> 0000
> 0001      TYPE LINE=sline:STRING[17]
> 0011      TYPE HEADER=head:STRING[21]
> 0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
> 0049      (* Trying to say that type SCREEN is a HEDER followed by an array of 6 LINEs s each consisting of up to 17 characters. *)
> 00C2
> 00C3      DIM aline:LINE
> 00CC      DIM ahead:HEADER
> 00D5      DIM apage:PAGE
> 00DE
> 00DF      apage.ahead="This is the Header field of the page"
> 010E      apage.aline(1)="This is line ONE of the page."
> 0138      apage.aline(2)="This is line TWO of the page."
> 0162      apage.aline(3)="This is line THREE of the page."
> 018E
> 018F      PRINT apage
> 0194
> 0195      END
> 00DD ERROR #024
> 00E6 ERROR #066
> 010D ERROR #071
> 0114 ERROR #065
> 0117 ERROR #066
> 0137 ERROR #071
> 013E ERROR #065
> 0141 ERROR #066
> 0161 ERROR #071
> 0168 ERROR #065
> 016B ERROR #066
> 018D ERROR #071
> 
> 
> 
> On 2021-04-04 10:14, coco at jechar.ca wrote:
>> I am trying to create a type that consists of a field that is a 21
>> character string
>> followed by a field that is an array of 17 character strings. I read
>> some documentation and am not sure it is even possible this was my
>> attempt and it's errors,
>> PROCEDURE ttype
>> 0000
>> 0001      TYPE LINE=sline:STRING[17]
>> 0011      TYPE HEADER=head:STRING[21]
>> 0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
>> 0049      (* Trying to say that type SCREEN is a HEDER followed by an
>> array of 6 LINEs s each consisting of up to 17 characters. *)
>> 00C2
>> 00C3      DIM aline:LINE
>> 00CC      DIM ahead:HEADER
>> 00D5      DIM apage:PAGE
>> 00DE
>> 00DF      apage.ahead="This is the Header field of the page"
>> 010E ERR     apage.aline(1) "This is line ONE of the page."
>> 013F ERR     apage.aline(2) "This is line TWO of the page."
>> 0170 ERR     apage.aline(3) "This is line THREE of the page."
>> 01A3
>> 01A4      PRINT apage
>> 01A9
>> 01AA      END
>> 00DD ERROR #024
>> 00E6 ERROR #066
>> 010D ERROR #071
>> Can this be fixed or am I trying to do the impossible.
>> Charlie
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list