Each program which wants to work with a file must initiate the following actions:
If the file is not yet cataloged and has no storage space allocated: create the file (by means of a FILE macro or CREATE-FILE command).
Open the file (by means of the OPEN macro): the system checks whether the calling job may access the file and, if so, prepares the actual access to the contents of the file.
Access to the file contents (with the DMS access methods): when requested, the system transfers the data between the calling job and the file.
Close the file (using the CLOSE macro): the system logically disconnects the calling job from the file; after this, any further requests for data transfer are rejected.
A job may open, access and close a file as many times as it wants. As opening and closing a file are time-consuming operations, a job should open files only when it can process them and close them only after all processing has been completed.