%OPEN Function

%OPEN built-in function returns True if the specified file is open.

%OPEN (File_name) 
        

Parameters

File_name

Required. The name of the file.

Remarks

A file is considered “open” if it has been opened by the RPG program during initialization or by an OPEN operation, and has not subsequently been closed.

If the file is conditioned by an external indicator and the external indicator was off at program initialization, the file is considered closed, and %OPEN returns False .

Example

// This goes in main line code
DclDiskFile Name( CUSTMAST ) Type( *Input ) Org( *Indexed ) DBDesc ( "ASNA LOCAL DB" )
MsgBox %OPEN ( CUSTMAST )
Close File   ( CUSTMAST )
MsgBox **%OPEN**  ( CUSTMAST )
ENDSR      ```?</pre>

### See Also
[Built-in Function Overview](Functions_overview.html)

[IsOpen Property](IsOpen_Property.html)