× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I've been a priming read/dow type of guy since college when my professor
brought in the results of my assignment that I handed in. Back then we
sent them electronically (the early 90s) and they were automatically run to
make sure they worked and the results were printed out on green bar paper.

He had two stacks. One of about 20 sheets (the rest of the class). Then
one that was a stack of green-bar paper 10 inches high (at least 1/3 of a
box full) that he slammed on the table, pointed at me and said "I will talk
to you, Mr. Stone, after class..."

It had ran all night since when they tested our programs they tested it
with data and without data. When mine ran without data without a priming
read it did an Infinite loop of garbage... let's just say I learned from my
mistake. :) If not for them finding it, it may still be running today...
lol.

This was my first comp sci college assignment using Modula-II... I had only
used BASIC with GOTOs and GOSUBs on a home TRS-80 and later a PC before
that... writing text based adventure games similar to Raaka Tu (remember
that one? So awesome!) and Zork.

I learned two things that day, I will ALWAYS do a priming read for my
loops... and that public shaming DOES work. :)

Brad
www.bvstools.com

On Tue, Mar 8, 2016 at 11:16 AM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

You pays your money - you takes your choice!

I prefer priming a DOW loop with a READ of whatever sort - I don't really
like doing a LEAVE in the middle for EOF condition - seems too much like a
GOTO abuse.

But this is personal taste for the most part - I agree with using the file
name in the %eof() - keeps things clear. And ensures testing the right
condition.

Here's a "priming" version of the 2nd one below - only 1 %eof test - even
though this shows 2 reads - and I might add a %equal test - as someone else
suggested - it's like what I do in embedded SQL - after an OPEN I check
SQLCOD = 0, then do my first FETCH if successful. Then a DOW of SQLCOD
there. I digress!!

firstkey setll file
firstkey reade file

do while not %eof(file)

if not SkipCondition
...do stuff...
endif

firstkey reade file
enddo




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.