Release the NEW Power of CL

Release the NEW Power of CL

Name:

Email:

Profile Manager

Stop spending time and money reinstating user profiles!

Try Profile Manager Today!

30 DAY FREE TRIAL

Learn More

Programming Services

Do you need a program written?

Bruce Vining Services can provide highly experienced IBM i developers to supplement your staff with short term contracts. If you are looking for custom solutions involving system functions such as communications, database, security, encryption, print, and work management you will find your answers at Bruce Vining Services.

PDF Print E-mail

Close File (CLOSE)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
Threadsafe: Conditional
Parameters
Examples
Error messages

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.
Top

Parameters

KeywordDescriptionChoicesNotes
OPNID File identifier Simple name Optional, Positional 1
Top

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.
Top

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.

Top

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.
Top
 
Joomla 1.5 Templates by Joomlashack