🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2956

Re: Arrays of Records and Sequential File Reading

#2956
From: Dieter Wienrich
Date: Thu, 26 Oct 1995 10:50
45 lines
2040 bytes
rleroux@direct.ca (robert leroux) wrote:
> 
> IF IsMatch = Str.Match (title,singlebook[x].TITL THEN
>   (*print the whole RECORD of singlebook[x].????*)
>  ELSE
>   (*Display to user that no match was found.  Then loop back to start of program to allow another search*)
> 
> I am using 'x.' so that the whole ARRAY will be searched along with the field.
> IsMatch is declared as a BOOLEAN.
> 
> Am I on the right track?
> 
> As for the actual record:
> 
> BOOK = RECORD
> 	  TITL : Title;		(*TITL, AUTH, COPI AND DATE are an ARRAY of CHAR*)
> 	  AUTH : Author;
> 	  COPI : String;
> 	  DATE : Due;		(*Eventually this will be arrayed so that I can have up to 
> 	  END;			  four Dates per book*)
> 
> Library = ARRAY [1..maxbook] OF BOOK;  (*according to all the references I read, this line should take 
> the four fields in record BOOK and address them per ARRAY until it reaches the maximum or before (if 
> the data file is shorter than maxbook)).
> 

(Sorry, i sent you a mail instead of a newsgroup message)

for scanning the whole library you have to use code like this
 (not exact modula)
 found:=false;
 for x:=1 to maxbook do
   if match(searchtitle, library[x].title then
        output result;
	...
	found:=true;
   end;
 end;
 if not found then output "not found" end;
 
 This scans the whole library;  Look at Str.Match(), which will work
  with wildcards, for exact match it is possible to use
  Str.Compare();
  
 Dieter Wienrich
Technical Details
Message-ID: <46np6j$1bv@p235.informatik.uni-Bremen.de>
Path: arc1-ca.pugleaf.net!informatik.uni-bremen.de!news
References: <46iq1p$4id@grid.Direct.CA> <DGysxx.98u@cix.compulink.co.uk> <46ngu2$r72@grid.Direct.CA>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!informatik.uni-bremen.de!news
From: Dieter Wienrich <dwien@alf.zfn.uni-bremen.de>
Newsgroups: comp.lang.modula2
Subject: Re: Arrays of Records and Sequential File Reading
Date: 26 Oct 1995 10:50:59 GMT
Organization: Universitaet Bremen, Germany
Message-ID: <46np6j$1bv@p235.informatik.uni-Bremen.de>
References: <46iq1p$4id@grid.Direct.CA> <DGysxx.98u@cix.compulink.co.uk> <46ngu2$r72@grid.Direct.CA>
NNTP-Posting-Host: 134.102.88.201
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit