[comp.lang.pascal] HELP! Turbo Pascal v2.0 problem on Zeniths

michelle@bcsfse.UUCP (Michelle Midkiff) (03/17/88)

I've come up against a real mind-boggler and I'm hoping that someone
out there in netland can help me.  I have a program which I developed
on an IBM PC using Turbo Pascal ver2.0.  It's been running successfully
on multiple IBM PC's for several years now, but the users (in there
infinite wisdom ;-) ) have decided to use Zenith Z-200's now and so
attempted to run the program on a Zenith.  The program runs fine except
when a certain option (I'll call it Option A) is selected.  Then the
program crashes with a run-time error 10, which the manual defines as:

            STRING LENGTH ERROR.
                1) A string concatenation resulted in a string of more
                than 255 characters.  2) Only strings of length 1 can
                be converted to a character.

However, the program runs correctly on the IBM PC when Option A is
selected.  What's really weird, though is that the statement on which
the error occurs is always executed, regardless of whether or not
Option A is selected.  Which leads me to believe that this is a
compatibility problem.

The code which produces the error looks like this (this is an exerpt):

  TYPE  DataType = record
                      Element : integer;
                       ElName : string[25];
                   END;
        DataStor = array [1..200] of DataType;

  VAR  Title : string[8];
       Data  : DataStor;
       Indx  : byte;
       Index : integer;

  writeln (Lst, 'vvv');
  while Data[Index].Element <> 999 do
     with Data[Index] do
         BEGIN
             for Indx := 1 to 8 do
                 Title := Title + ElName[Indx]; *** error occurs on ; ***
             writeln (Lst, 'xxx');
                  .
                  .
                  .
                 
         END;

The program errors out before it completes the first loop.  i.e. The
writeln (Lst, 'xxx'); doesn't execute, but the 'vvv' does.  I've 
checked all the values for ElName and it never exceeds the length of 
25, possibly equals 25, but never exceeds.

I've tried calling Borland....they're clueless.  I can't tap into 
Boeing's expertise because neither the program nor the company are
Boeing related.  And upgrading Turbo Pascal is not feasible in this
situation.  Does anybody out there know about specific compatibility
problems with the Zenith Z-200 series?  Any other ideas?  Please
respond by email since I don't normally read this news group.

                     Thanks in advance,
                                  Michelle
-- 
Michelle Midkiff              ...!uw-beaver!ssc-vax!voodoo!bcsfse!michelle
FSE Development Project                                 Renton, Washington
Boeing Computer Services                                    (206) 656-7732

rbw@WILLIAMS.edu (03/19/88)

Your code:
> for Indx := 1 to 8 do
>     Title := Title + ElName[Indx]; *** error occurs on ; ***
> writeln (Lst, 'xxx');

Why not replace this fragment with the equivalent 

Title:=Title + copy(Elname,1,8);

or even (for the purists)
Title:=concat(Title,copy(Elname,1,8));

This would put the potentially offending code back in the intrinsic
function department, and that is assumed to be correct ;-).

-Richard Ward
rbw@cs.williams.edu
Williams College, Williamstown, MA

neubauer@bsu-cs.UUCP (Paul Neubauer) (03/20/88)

In article <12503@brl-adm.ARPA> rbw@WILLIAMS.edu writes:
+Your code:
+> for Indx := 1 to 8 do
+>     Title := Title + ElName[Indx]; *** error occurs on ; ***
+> writeln (Lst, 'xxx');
+
+Why not replace this fragment with the equivalent 
+
+Title:=Title + copy(Elname,1,8);
+
+or even (for the purists)
+Title:=concat(Title,copy(Elname,1,8));
+
+This would put the potentially offending code back in the intrinsic
+function department, and that is assumed to be correct ;-).

Considering that the type of Title was string[8], what is going on here is
that he is trying to start from a blank title and fill ALL 8 characters of
it from Elname.  So an even more sensible thing for the purist to do would
be:
	Title := copy(Elname,1,8);
This would also make SURE that he is not actually concatenating onto
something that is already there due to lack of range checking by Turbo. 
(N.B. range checking is OFF by default in Turbo.)

-- 
Paul Neubauer         neubauer@bsu-cs.UUCP
                      <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!neubauer