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