I was wondering how you go about using the Start statement in COBOL to position a file to find records in an input file that are duplicates/copies.

Im not sure if I am getting the syntax right. I'm trying to find all the duplicate records in an input file. I've tried several different ways, including putting an if statement, but nothing works

...also, I can't post code since the code is for an entity.

Any help appreciated

If you want to find duplicate records in a file, the easiest way to do that is to sort the file on whatever field(s) you want to check for duplicates, (or the whole record if that's what you're looking for), and then open it as a sequential file, and read it, and for each record read, save the contents (or key) to a working-storage field, and then check the next record read to see if it matches, and if it does, write the record to another file, or do something else to notify you that it was a duplicate. I think the start statement syntax is pretty much the same as the read syntax for indexed files, but to find duplicates, I think you will find the way I described to be easier and probably faster. That's the way I'd do it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.