× 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 prefer a dow %found loop to a dou not %found loop in this scenario, because sometimes there are no records, and the dou will execute once, even if there are no records.

sjl wrote:
John -

In the example you gave,
CHAINing with only the key CO# gets the first record for that company (in order by RestNm).

In fact, this chain (if successful),

Chain CO# myfile;

is functionally equivalent to:

Setll CO# myfile;
Reade CO# myfile;


Here is another example, except using a partial key to delete records...
(I'd venture to guess that many RPG programmers don't know about this obscure use of the DELETE operation)


FFDC4363 UF E K DISK
*
C XXKY01 KLIST
C KFLD XXDOCO
*
C XXKY02 KLIST
C KFLD XXDOCO
C KFLD XXDCTO
*
* Fixed-format version
* (Delete all records for order # 1117)
*
C Z-ADD 1117 XXDOCO
C DOU NOT %FOUND(FDC4363)
C XXKY01 DELETE(E) IDC4363
C ENDDO
*
*
* Free-format version.
* (Delete all records for order # 1118)
*
/free

XXdoco = 1118;
Dou NOT %FOUND(FDC4363);
Delete(E) XXKY01 IDC4363;
Enddo;

*INLR = *On;

/end-free
*


- sjl




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.