× 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.



rpg4rico2@xxxxxxxxxxx wrote:
> 
> When I first viewed the following, I laughed so hard it hurt.
> 

The thread has wandered off "worst RPG", but I can't resist submitting
this entry anyway.

This code reads through the records of a file, and keeps track of which
customer types are in the file.

        clear   custtypes
        read    custrec
        dow     not %eof
        for     i = 1 to %elem(custtypes)
        if      custtype = i
        eval    custtypes(i) = *on
        read    custrec
        if      %eof
        leave
        endif
        eval    i = 1
        endif
        endfor
        enddo

I don't know which part is better, mixing the read loop with the array
search loop, or the array search itself, where it is looping through the
indexes, searching for an index that matches.

Here's a shorter version of the code that does (almost) the same thing. 
(The difference is that it works correctly when custtype = one)
        clear   custtypes
        read    custrec
        dow     not %eof
        eval    custtypes(custtype) = *on
        read    custrec
        enddo


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.