Closing Files

It is important to close files you are working with as soon as you are finished with them. This minimizes the amount of user virtual machine resources required and helps keep shared files and directories available for other users. Closing a file means logically disconnecting it from the application program.

Note that closing a file in an SFS directory control directory does not always make the file available to other users for writing. If you have a directory control directory accessed in read/write status, no other user can write to any file in the directory so long as you have the directory accessed. Closing the file, in this case, does not make the file available to others for writing.

The DMSCLOSE routine (Close) closes files previously opened by using the DMSOPEN routine. You pass the token from DMSOPEN to identify the files that you are closing. You may also want to include the COMMIT parameter to commit the changes made to the files after they are closed, if you want to ensure any uncommitted changes.

Example: To close and commit an output file that has been updated, issue:
commit='COMMIT'
comlen=length(commit)
 
call csl 'DMSCLOSE retcode reascode tokenw commit comlen'