The V5R2 RPG ILE reference is wrong on one point - it says that if there is a search argument (key field or KLIST), then the record has to have been locked by a CHAIN or a READE. In fact, just the opposite is true - is there is NO search argument, DELET removes whatever is the current record. So this works fine.

But a DELET with a search argument does not need a CHAIN or READE - it deletes the first record that matches the search argument, and %found() works in the context of DELET. So the cleanest (fewest lines of code, perhaps?) has the key on the DELET, both outside the loop and inside it, as Rick Baird suggested (below).

Vern

At 10:51 PM 9/18/2003 -0500, you wrote:
Trigger programs.  Write trigger programs to prevent widows and orphans.  Do
it once and forget it. Don't rely on your programmers getting it right every
time.



As for the delete loop, wouldn't this be fairly simple:



>c ORDER chain (e) BLPART

>

>c Dow %found(BLPART)

>c Delete BLPART

>c ORDER chain (e) BLPART

>c enddo



---------------------------------------------------------

Booth Martin http://www.MartinVT.com

Booth@xxxxxxxxxxxx

---------------------------------------------------------



-------Original Message-------



From: Midrange Systems Technical Discussion

Date: Thursday, September 18, 2003 16:08:50

To: midrange-l@xxxxxxxxxxxx

Subject: RE: Sequence error in MR



Rick,



I think you will not delete any record the way you do it. You will get an NF
or EOF condition and the file pointer will be moved to EOF and remains there




So I use SETLL to reset the file pointer (just to be sure it is in the right position) and then start deleting the records (by key).



Regards,

Carel Teijgeler.



*********** REPLY SEPARATOR ***********



On 18-9-03 at 15:04 rick.baird@xxxxxxxxxxxxxxx wrote:



>Carel,

>

>If you're going to use the cycle, why setll? just do it this way:

>

>fBONLPF IP E K DISK

>fBLPART UF E K DISK

>

>c ORDER Delete BLPART

>

>c Dow %found(BLPART)

>c ORDER Delete BLPART

>c enddo







_______________________________________________

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list

To post a message email: MIDRANGE-L@xxxxxxxxxxxx

To subscribe, unsubscribe, or change list options,

visit: http://lists.midrange.com/mailman/listinfo/midrange-l

or email: MIDRANGE-L-request@xxxxxxxxxxxx

Before posting, please take a moment to review the archives

at http://archive.midrange.com/midrange-l.



.
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



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.