*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | CLOSE | | File name | | _ ER _ | *---------*---------------*-----------------*----------------*---------------*
The explicit CLOSE operation closes one or more files or devices and disconnects them from the program. The file cannot be used again in the program unless you specify an explicit OPEN for that file. A CLOSE operation to an already closed file does not produce an error.
Factor 2 names the file to be closed. You can specify the keyword *ALL in factor 2 to close all the files at once. You cannot specify an array or table file (identified by a T in position 16 of the file description specifications) in factor 2.
You can specify a resulting indicator in positions 56 and 57 to be set on if the CLOSE operation is not completed successfully. Positions 54, 55, 58, and 59 must be blank.
Multiple CLOSE operations to a file already closed are valid. A second close to the same file has no effect on that file.
If an array or table is to be written to an output file (specified in positions 19 through 26 of the extension specifications), the array or table dump does not occur if the file is closed (by a CLOSE operation) at LR time when the file is written. If the file is closed, it must be reopened for the dump to occur.
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* The explicit CLOSE operation closes FILEB. C* C CLOSEFILEB C* C* The explicit CLOSE *ALL operation closes all files in the C* program. To reopen the files, you must specify an explicit C* OPEN for each file. If the CLOSE operation is not completed C* completed successfully, indicator 17 is set on and the C* program branches to the label specified in the GOTO statement. C CLOSE*ALL 17 C 17 GOTO NOCOMP CLOSE FAILED C : C : C : C NOCOMP TAG
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.