info-vax@ucbvax.ARPA (02/23/85)
From: Mike Iglesias <iglesias@uci-icsa> I'm trying to convert a VMS PASCAL program to run on another system (Honeywell CP-6). I don't have a VMS PASCAL manual (I know, I know, I should have one, but...) and I've run across something that I don't understand. What does the following generate for st? VAR st: VARYING [80] of char; Thanks in advance, Mike Iglesias University of California, Irvine iglesias@uci-icsa or iglesias@uci-750a
info-vax@ucbvax.ARPA (02/25/85)
From: John_Aronsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA VARYING OF CHAR is a predeclared record type in VMS-PASCAL. Syntax: VARYING [upper-bound] OF [attribute-list] CHAR upper-bound is an integer in the range from 1 throgh 65535 that indicates the length of the longest possible string. VARYING [upper-bound] OF CHAR may be thought of as the record type: RECORD LENGTH : [WORD] 0..upper-bound; BODY : PACKED ARRAY [1..upperbound] OF CHAR; END; LENGTH and BODY are predeclared fields in VMS-PASCAL. Example: VAR st : VARYING [80] OF CHAR; BEGIN st := 'FOO'; Writeln(st.length); (* write 3 *) st := 'BLETCH'; Writeln(st.length); (* write 6 *) Writeln(st); (* This will just write the 6 characters 'BLETCH' *) Writeln(st.body) (* But this will write 80 characters. Mostly junk. *) END.