+ Reply to Thread
Results 1 to 3 of 3

Thread: Duplicate keys

  1. #1

    Default Duplicate keys

    Ted, What does this program need to do? Have you considered SQL or Query? On Friday, May 29, 1998, 06:27 AM, Ted Sarah wrote: We have a file that contains the SSN as one of it's field. It is not a primary key, but a logical key, and so the data can be duplicated in many records. I am in the need of a quick and dirty program that can read this file and list certain fields in the record. I would write it myself, but I don't think it can be done in CL. But, I could be wrong. I can fuddel my way through an RPG program, but not write from scratch. Anyone got something like this? Ted

  2. #2
    Guest.Visitor Guest

    Default Duplicate keys

    On Tuesday, June 02, 1998, 10:53 AM, Ted Sarah wrote: The program needs to look at the key (SSN) and print any duplicate records, this could be 2,3, or more records. It does need to print the first as well as all following records. Needs to print name, ssn, dob, record key.
    In 400 SQL it takes two SELECT statements... First: select SSN, Count(*) from file_name group by SSN having Count(*) > 1 put the result table into an outfile; second join this outfile with table = file_name on SSN. IN mainframe DB/2 i think you can use a sub-select .. Bob Hamilton TEXAS BUSINESS SYSTEMS 736 Pinehurst Richardson, Texas 75080

  3. #3

    Default Duplicate keys

    I think you could do it in one: select * from file_name where SSN in (select SSN from file_name group by SSN having count(*) > 1) On Tuesday, June 02, 1998, 02:18 PM, Bob Hamilton wrote: The program needs to look at the key (SSN) and print any duplicate records, this could be 2,3, or more records. It does need to print the first as well as all following records. Needs to print name, ssn, dob, record key. In 400 SQL it takes two SELECT statements... First: select SSN, Count(*) from file_name group by SSN having Count(*) > 1 put the result table into an outfile; second join this outfile with table = file_name on SSN. IN mainframe DB/2 i think you can use a sub-select .. Bob Hamilton TEXAS BUSINESS SYSTEMS 736 Pinehurst Richardson, Texas 75080

+ Reply to Thread

Similar Threads

  1. Duplicate key with a deleted record
    By David Abramowitz in forum RPG
    Replies: 4
    Last Post: 04-20-2005, 06:38 AM
  2. RPG - Duplicate key on access path
    By David Abramowitz in forum Programming
    Replies: 4
    Last Post: 09-12-2001, 09:43 AM
  3. Duplicate records
    By Guest.Visitor in forum Application Software
    Replies: 3
    Last Post: 03-13-2000, 01:23 PM
  4. Duplicate keys
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 12-05-1998, 02:32 PM
  5. Duplicate Messages
    By Guest.Visitor in forum Analysis
    Replies: 2
    Last Post: 07-01-1998, 11:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts