I have a clarification on the FINISH statement.
I understand that FINISH statement is generally used to end a run unit by releasing database resources and to prevent potential time-outs. My query is even if the program does not specify a FINISH explicitly in the code, when the COBOL program completes successfully, does the run-unit terminate and the resources gets freed up by default even if there is no FINISH ?
Is it similar to the case as in files ? I mean something like we do not specify a CLOSE statement of a FILE towards end of a COBOL program. But when program completes the file is automatically closed.
The FINISH statement either has not been coded or has been coded incorrectly. Check the FINISH statement for proper syntax. Note that programming logic for subprograms or for non-IDMS programs may generate this warning automatically; in this case, corrective action is unnecessary.
A "FINISH" should always be issued before terminating a program. Issue the FINISH as soon as database I/O is completed to free-up resources and to prevent potential time-outs
Also if you are using RETURN-CODE in your program then the value in it would get overriden by FINISH.
All in All it is recomended not to miss FINISH for thr RUN-UNIT to get it ended otherwise get ready for surprises.
And found that with and without a FINISH would results into different results and that varies per scenario. For e.x. Area Lock ( Local Mode) the locks remian set unless it finds FINISH. FINISH would also update all statistical information as needed for every DB operation
So you might have to read this completely for importance of FINISH and then I am sure you would get answer to all your doubts.