Close File (CLOSE)
The Close File (CLOSE) command closes a file previously opened with an Open File for Processing (OPEN) or Open File using CLF (OPNFCLF) command. The file cannot be used again unless re-opened with an OPEN or OPNFCLF command.
This command is unique among the CLF commands in that the File identifier keyword is OPNID rather than FILEID. This difference is due to IBM providing a CLOSE command in V6R1. The precompiler, when a CLOSE command is encountered in the CL source, will determine if the specified file identifier was previously declared using the DCLFCLF command. If so, the precompiler will use the CLF provided file close support. If the file identifier was not previously declared using the DCLFCLF command then the precompiler will leave the CL command as is and allow the i provided file close support to be run.
This command never runs in the traditional sense and will return an error if an attempt is made to run the command. The CLF precompilers, when they encounter this command in a CL source program, replace the command and generate CL instructions directly into the compiled CL program.
Restrictions:
- This command can only be used in a CL program that is created using a CLF precompiler command. The CLF precompiler commands are CRTBNDCLF, CRTCLFMOD, and CRTCLFPGM.
| Keyword | Description | Choices | Notes |
| OPNID |
File identifier |
Simple name |
Optional, Positional 1 |
File identifier (OPNID)
Specifies the file identifier that was used on a previous Open File for Processing (OPEN) or Open File using CLF (OPNFCLF) command in the application.
This parameter is used by CLF commands to identify the file to be processed by the command.
This is a required parameter.
- simple-name
- Specify a name that matches the FILEID parameter value of a previous OPEN or OPNFCLF command.
Examples for CLOSE
Example 1: Closing a File
Close OpnID(DPT)
This command closes the file identified by a FILEID of DPT. The file must have been previously opened in the same program that is using the CLOSE command.
Error messages for CLOSE
*ESCAPE Messages
- VC29002
- Function did not complete. See previously listed messages related to possible user errors.
- VC29003
- Function did not complete. See previously listed messages for possible cause.
- VC29004
- Function did not complete. See previously listed messages for possible cause.
- VC29005
- Function did not complete. Contact your service provider.
|