OneMany logic to accompany example that needs to be debugged
This talks about a one to many relationship with one on file 1 and 1 or many or file 2. Each id must appear on both file 1 and file 2.
The program to handle this has errors. Your project is to debug the program and produce a program that will work. This slide show deals with the logic to help you debug.
Whatever you create you should manually test it against sample files to make sure that the processing makes sense.
This shows the conventional flowchart that I use in class.
Note that holdid in this example is doing more than simply holding the id, it is also a validation that the id has been processed with matching records. When ID1 = ID2, move ID1 to the holdid. Note that this will be done each time but that is not a logic problem.
Alternative method of showing the logic. This one uses the concept of comparison in the decision block.
ID1 : ID2
This has three possibilities: <, =, >
This has two possibilities: =. not=
The flow shows one line feeding into another and shows the return to the entry point.
This shows an embedded inner loop. Once a match is found I stay in the inner loop until the record I read from file 2 no longer matches. At this point, I write and read another file 1.