close considerations for file I/O

In the context of file I/O that does not involve databases, the EGL close statement closes the file associated with a given record variable.

If a file is open and you use the record.resourceAssociation variable to change the resource name that is associated with that file, EGL closes the file automatically before it runs the next statement that affects the file. For details, see resourceAssociation variable for file I/O.

When the program ends, EGL also closes all open files.

Syntax

Syntax diagram for the close statement using file I/O
recordVariable
Name of an indexed, relative, or serial record that is associated with the file being closed.

Example

if (userRequest == "C")
   try
      close recordA;
   onException(fileErr FileIOException)
      myErrorHandler(fileErr);
   end
end 

Compatibility

Table 1. Compatibility considerations for the file I/O close statement
Platform Issue
CICS® for z/OS®
  • A close statement does not delete temporary storage files.
  • EGL automatically performs close processing when a segment break occurs at a converse as well as at the end of the program.
IMS™ BMP or z/OS batch EGL issues an OS CLOSE for the file.

Feedback