by BillyBoyo » Sat Jun 15, 2013 4:55 am
I notice that you are DISPLAYing ENTRADA, not REG-ENTRADA.
As I mentioned before, you are "processing" a record after end-of-file. You also do your DISPLAY before you have read the first record.
You don't seem to fully understand about the use of SECTIONs. It is not good practice, to my mind, to PERFORM a SECTION which contains a STOP RUN. STOP RUN is not such a good way to end a program, particularly as yours is using SQL. GOBACK will be much better. PERFORM the final part, then just GOBACKm outside of the SECTION.
Find out about and use 88s, with EVALUATE TRUE. Avoid "nested" EVALUATEs. Put them into SECTIONs (since you use those) with meaningful names.
Again as I mentioned before, you have no FILE-STATUS checking. You should check after every I/O operation that all was well, It will save you many, many hours over the years.