Joined: 20 Oct 2006 Posts: 6970 Location: porcelain throne
no, cobol is rather explicit about which module can perform i/O. Which ever module contains the FD, that module, and only that module, can execute i/o against the FD.
Suggest that you remove the FD from the main module, write a new module (an i/o module) that can be called from anyone to perform the i/O functions. The way you have it set-up, a submodule must return to the main module to get the next or write/rewrite and then immediately be called again by the main-module. That means a lot of decision making in the main as well as the sub-module.
removing i/o to a sub-module allows a programmer to design a flexible run-unit. any module needing another record or wanting to update the file can perform an 'in-line call' to the i/o module.
In addition, if the data was formerly in a qsam file, it could be changed very easily to a vsam or db2 by only having to modify 1 i/o module.