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



Hi,

The requirement can be accomplished by the following source code or logic.
All you need is a logical file with the first field as key.

In your RPG program, you need to use the logical as primary file.
A sample case is presented:

Consider example1 is the logical file keyed on loan number.
Task is to write the duplicate records to output2 and unique records to 
output1.
The same can be acheived by the folowing code piece.

     FEXAMPLE1IP  F      15  5AI     1 DISK
     FOUTPUT1 O   F      15                 DISK                      A
     FOUTPUT2 O   F      15                 DISK                      A
     IEXAMPLE1NS
     I                                        1   50LOAN  L1
     I                                        6  15 NAME
     C                     EXCPTADDDUP
     CL1                EXCPTADDUNQ
     OOUTPUT1 EADD             ADDUNQ
     O                                                LOAN       5
     O                                                NAME      15
     OOUTPUT2 EADD    NL1 ADDDUP
     O                                       NL1 LOAN       5
     O                                       NL1 NAME      15

Attached zip file has my test source codes and files for your reference.


Thanks,
Muthu






murali dhar <hydchap1@xxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
01/03/2006 06:26 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
duplicate rec






Hi
  I have below PF, which daily gets added with several number of records.
  This file consists several duplicate records(mainly on KEPOLX).
  With RPG III(no RPGIV, no SQL)  I want to create  two files from the 
data of this PF file . First file should consists all  duplicate records 
and second file should consists only unique records by eliminating 
duplicate records.Please help with some pointers.
  Thanks for your help,
 
 
                                           REF(DTAREF)                   R 
RGDTRANS 
    KEPOLX        11A 
    KERQSX    R               REFFLD(RDTARF2/KERQS *LIBL/ 
    POLTYX    R               REFFLD(POLTY) 
    PETIDX         5A 
    KESTSX    R               REFFLD(RDTARF2/KESTS *LIBL/ 
    PRTXTX       256A 


 
---------------------------------
 Yahoo! DSL Something to write home about. Just $16.99/mo. or less

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.