When we have a file with Duplicate records and I want to read the unique record from the file. For example a file containing Emp Name as 'Ram' and there are 3 entries of it. So how to read a unique record from File?



When we have a file with Duplicate records and I want to read the unique record from the file. For e..

Answer / Om Pal Singh

To read a unique record (i.e., removing duplicates) from a file in RPG400, you can implement a key sequence comparison on the duplicate fields and only process the first occurrence of each unique combination of keys. Alternatively, you may use SQL statements to eliminate duplicates using the DISTINCT keyword or grouping functions.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More RPG400 Interview Questions

Hi all friend, Could Any body send me the code (with coding) of this senario because I have tried but I am stucking somewhere so Please reply ASAp with coding. senario:Q: I have to write the flat file(FLAT1) into the three different PFS (PF1,PF2 and PF3) with the respect of H line data, D line data and Z line data of flat file. where I have different data in flat file(FLAT1) which is mentioned below with data. H0929200909282009092820095529420003000073 D2222220006765555webservi001633.9909222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840001633.99001633.99851856492689800208001915 511001633.990408490000000.0000000003446048 1,3 110793145 09070700351 372367 Rosner Motors D3333320006774444webservi000271.2409222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840000271.24000271.24851856492689800208001835 511000271.240930680000000.0000000003450293 1 110793254 09072100079 373933 Rosner Motors Z0929200900000020001905.25 FLAT1 has the three pf data H line-represents the header pf data,D-Represent Details pf data,Z-Represents the trailer pf data Now I have to write H line data of flat file into Header pf (PF1),D line data of flat into datails pf(PF2) and Z line data of flat file into pf(PF3) with the spefic position(H,D and Z data of flat file into PF1, PF2 and PF3) of flat file.

4 Answers   IBM,


do you use message subfiles? What are the necessary keywords required coding a message subfile?

1 Answers   IBM,


how to run only 10 modules of existing N modules in service program in RPGILE ?

3 Answers   Wipro,


How can we make use of SETLL operation in CL?

11 Answers  


How we will read call stack?

4 Answers  


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

12 Answers   IBM, Opus,


1.Write code to read the records from a file and load an array of size 99? Make sure that you take care of all the error conditions?

2 Answers   HSBC,


how to convert date format from one format to another i think in CL/400 its CVTDAT,Please tell in RPG/400 sir not in RPGILE

3 Answers   iGate,


two types of read performed in dataqueue?????

4 Answers   CTS,


Write a program to display prime numbers between 1 to 100 using RPGLE.

1 Answers  


what will happen two jobs have same name are submitted

5 Answers   CTS,


WHAT IS MEANT BY SIGNATURE VAILOTION ERROR

1 Answers   IBM,


Categories