The EGL close statement disconnects a printer; or closes the file or message queue associated with a given record; or, in the case of an SQL record, closes the cursor that was open by an EGL open or get statement.
Example:
if (userRequest = "C") try close fileA; onException myErrorHandler(12); end end
The behavior of a close statement depends on the type of I/O object.
When you use the name of an indexed, serial, or relative record in a close statement, EGL closes the file associated with that record.
If a file is open and you use the fileAssociation item to change the resource name associated with that file, EGL closes the file automatically before executing the next statement that affects the file. For details, see resourceAssociation.
EGL also closes any file that is open when the program ends.
When you use the name of a MQ record in a close statement, EGL ensures that the MQSeries command MQCLOSE is executed for the message queue associated with that record.
If the I/O object is a print form, the close statement issues a form feed and either disconnects from the printer or (if the print form is spooled to a file) closes the file.
Before you use sysVar.printerAssociation to change the print destination, close the printer or file specified by the current value of sysVar.printerAssociation. Issue a close statement option for each print destination, as multiple printer or print files can be open at the same time.
EGL run time ensures that all printers are closed when the program ends.
When you use the name of an SQL record in a close statement, EGL closes the SQL cursor that is open for that record.
EGL automatically closes a cursor in these cases:
EGL closes all open cursors in this case:
Related concepts
Record types and properties
resultSetID
Segmentation in text applications
SQL support
Related tasks
Syntax diagram
Related reference
add
delete
EGL statements
Exception handling
execute
get
get next
get previous
I/O error values
open
prepare
replace
recordName.resourceAssociation
SQL item properties
sysLib.commit
sysLib.rollback
sysVar.printerAssociation
sysVar.terminalID
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.