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

- 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
| Platform | Issue |
|---|---|
| CICS® for z/OS® |
|
| IMS™ BMP or z/OS® batch | EGL issues an OS CLOSE for the file. |