How to get only unique records from a file which contains duplicate data using CPYF command ?

Example : FILEA has duplicate records and FILEB is a UNIQUE defined.... and I want to get the data from FILEA to FILEB by eliminating all the duplicate records...

Answers were Sorted based on User's Feedback



How to get only unique records from a file which contains duplicate data using CPYF command ? Exa..

Answer / murali

First read PF and use pass data to the key fields of LF and check if record already find then skip if not then add record to LF.

Is This Answer Correct ?    0 Yes 0 No

How to get only unique records from a file which contains duplicate data using CPYF command ? Exa..

Answer / sandey243

There is an option in CPYF command which says " Error Allowed", making that as *NOMAX will trigger IGNORE option instead of CANCEL in CPYF processing; whenever there is duplicate record encountered.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More RPG400 Interview Questions

What is the RPG cycle?

3 Answers   CSC,


Have a join logical file with more than one members with different record formats. So how can we read the different members from this file and also how we can read the different record format from the join logical?

3 Answers  


what do you mean by an input subfile, what are the keywords required?

0 Answers   IBM,


1.find most occurrences of a character. for exm: input:aaabbbbdddddyyy output: d 5 times how can i get that?

14 Answers   HCL,


1. If there are two programs using same file and 2 users are using the file at the same time and what can be done to allow them both to access? 2. How can remove lock from the file for accessing it by both users?

0 Answers  






HI, 1: WHAT IS THE FUNCTION OF %KDS?WITH PROGRAMMING CODES EXAMPLE 2: WHAT IS THE FUNCTION OF Z-ADD AND Z-SUB ? WITH PROGRAMMING CODES EXAMPLE

1 Answers   IBM,


1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?

12 Answers   IBM, Opus,


i have 6 char field in program, but this field is using in all files i want to chage field size as 10 char , how can i do this except using *like defn...?

1 Answers   IBM,


difference betwen keywords and opcodes

3 Answers  


what is difference between DSPFD and DSPFFD?please give me real senario with good example?

1 Answers  


how many variables can we declare in cl pgm?

13 Answers  


How can read PF in reverse order (end to start) in CL pgm..

8 Answers   TCS,


Categories