Article View: comp.lang.modula2
Article #2992Re: Arrays of Records and Sequential File Reading
From: robert leroux
Date: Thu, 02 Nov 1995 10:02
Date: Thu, 02 Nov 1995 10:02
47 lines
2789 bytes
2789 bytes
In article <474odt$npe@p235.informatik.uni-Bremen.de>, Dieter Wienrich <dwien@alf.zfn.uni-bremen.de> says: > >> Str.Match(); I did not realize that Str.Match is a boolean function. After fixing >> that bug I have moderate success with the program. However, when I search the library, >> I am using a REPEAT/UNTIL loop with my IF Str.Match(title,singlebook[x].TITLE) THEN >> in between. If a match is found then I print out the Title of the specific book, If the >> title is not found in the library, then I print out that the title is not found, but during >> the search of the library until my 'x' := maxbook, I end up printing out 'book not found' until >> I find a match. I thought of changing the REPEAT loop to a FOR...NEXT loop, similar to what > >To be sure what your problem is: > >When running your program you enter a title and receive a lot of >"book not found" (until you get "found" or "end of list")? > >If this is not the problem, forget the rest and specify again. > > 1. you decide how to search: > the whole library (if there are serveral matches possible) > FOR x := 1 to max.. DO ... > only until the first match. > REPEAT ... UNTIL isFound > 2. you do your search, > but instead of output "not found" you set a boolean isFound > in your search loop, > 3. you evaluate isFound after the whole search. > if you set isFound := FALSE before your search, you must only set it > TRUE when there is a match. > >hope this helps > > Dieter Wienrich Thanks, I managed to get it happening just after the last post using a REPEAT . .. UNTIL loop. I am only working at getting the ARRAY of the date field working then I should be quite well off. I have an idea on how to address the Date filed and print out the dates per book depending on how many copies of the particular book is available, but I believe using the CASE statement, I would have to read in my 'copi' field as a CHAR so that I can compare it to the current copi that is read into the record. I am going to try to address this problem with an IF...THEN statement tomorrow first, otherwise I think reading in the copi field as a CHAR instead of a Str should solve my problem. > > > >
Technical Details
Message-ID:
<47a4vn$s5g@grid.Direct.CA>Path:
arc1-ca.pugleaf.net!newsfeed.direct.ca!usenetReferences:
<46ngu2$r72@grid.Direct.CA> <DH2EpC.MIo@cix.compulink.co.uk> <472lcc$kdk@grid.Direct.CA> <474odt$npe@p235.informatik.uni-Bremen.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newsfeed.direct.ca!usenet From: rleroux@direct.ca (robert leroux) Newsgroups: comp.lang.modula2 Subject: Re: Arrays of Records and Sequential File Reading Date: 2 Nov 1995 10:02:31 GMT Organization: Internet Direct Inc. Message-ID: <47a4vn$s5g@grid.Direct.CA> References: <46ngu2$r72@grid.Direct.CA> <DH2EpC.MIo@cix.compulink.co.uk> <472lcc$kdk@grid.Direct.CA> <474odt$npe@p235.informatik.uni-Bremen.de> NNTP-Posting-Host: 204.174.243.48 X-Newsreader: WinVN 0.92.6+