Or maybe instead of a file, using a data queue or message queue...

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin



                    thomas@inorbit.com
                    Sent by:                  To:     midrange-l@midrange.com
                    midrange-l-admin@mi       cc:
                    drange.com                Fax to:
                                              Subject:     Re: Re-reading a 
single record file in CLP

                    12/26/2001 03:20 PM
                    Please respond to
                    midrange-l






Dan:

Once you get the EOF message (CPAF0864), that instance of that CLP cannot
read (RCVF) any additional records from that file. Every additional RCVF
will result in CPF0864. Period. End of story. However... (see below)

On Wed, 26 December 2001, Dan Rasch wrote:

> I am trying to re-read a single record file in CLP.
>
> When I tried to RCVF in the program, I kept getting an error
> stating "End of file detected for file XAPURGP in REL003PURG."
> This was when I tried to read it the second time (and obviously anytime
> after).  I tried using POSDBF, and other goodies, but nothing worked.
>
> I had a deadline, and wrote a little ten line RPG program to make
> it work, but felt there must have been a CL solution that points
> back to the first (and only) record to read it again.

...since you wrote an additional program anyway, you might as well have
written it in CL. The second program (e.g., CLP2) will be CALLed each time,
so a CPF0864 from a previous CALL won't matter. You already had most of the
code written in your first version and could've copied to create the
second.

CLP2 would consist of the PGM command with appropriate PARMs and DCLs, the
DCLF, the RCVF with a MONMSG for CPF0864 plus whatever handling you wanted
to return an indication of EOF back to the caller, CHGVARs to set returned
values, and probably RETURN and ENDPGM.

In general, CL simply is not a database language. Although it is
technically possible without writing additional programs to extract records
from more than one file, to write records to database files and to extract
records again after reaching "end of file", the coding is hardly worth it.
Far easier just to write a pure dedicated CLP (or RPG as you did).

Tom Liotta

--
Tom Liotta
The PowerTech Group, Inc.
19426 68th Avenue South
Kent, WA 98032
Phone  253-872-7788
Fax  253-872-7904
http://www.400Security.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.