[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: File Read never gets #End-File set to True (1)



The only thing that "bugs" me about this is the use of the goto instead
of the break.  Beyond that, try the underscore that other respondants
have suggested.  Or use the generic version that does work ;)

>Date:         Thu, 11 Jun 1998 17:01:51 -0400
>Reply-To: SQR-USERS@USA.NET
>From: Don DeSmith <DESMITD@DOMINOS.COM>
>Subject:      File Read never gets #End-File set to True (1)
>To: Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
>
>I am attempting to use SQR 4 code to append one file to another file.
It =
>works when I use a custom procedure but I do not get an end-of-file =
>indicator (the SQR variable #End-File set to 1) when I tried to write a
=
>generic procedure.  I have attempted to narrow down the differences in
the =
>2 procedures, but the only thing left (that I can think of) is that the
=
>custom one is global (no parameters) and the generic one is local (I
pass =
>parameters).  In both cases I read and write the correct files, but in
the =
>bad case I keep reading, and reading, and reading, until I interrupt
the =
>process. =20
>
>Any experience with what could cause reading right off the end of the
file =
>(#End-File never changing from 0 to 1)?
>Any experience with procedures with parameters exposing SQR bugs?
>
>Here is a brief snippet of code with the error checking (and displays)
=
>taken out. It is pretty simple.
>
>
>begin-procedure
AppendFile($TargetFileName,#TargetFileNum,$SourceFileName,#=
>SourceFileNum,:#LocalAppendStat)
>  open        $SourceFileName    as    #SourceFileNum for-reading =
>record=3D200 status=3D#FileStat=20
>  while 1 =3D 1
>      read      #SourceFileNum     into  $AppendData:200
status=3D#ReadSta=
>t
>      if        #end-file          =3D     1
! =
><=3D=3D=3D=3D=3D=3D=3D=3D=3D Never 1 (True)
>          goto    AppendDone
>      end-if
>  end-while
>AppendDone:
>end-procedure
>
>
>Thanks much
>Don
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com