Many COBOL compilers will accept a SELECT statement that ASSIGNs to, for example, #DYNAMIC (a special name that says that you will assign a file name at run-time).
In your logic, you will then construct the real file name, call an ASSIGN utility (that comes with many compilers) to execute the ASSIGNment).
When you need to OPEN another file name, simply CLOSE the current file, execute another ASSIGN, and OPEN the new file. This lets you reuse the same SELECT to access multiple files.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.