%OPEN (Return File Open Condition)

%OPEN(file_name)

%OPEN returns '1' if the specified file is open. A file is considered "open" if it has been opened by the RPG module 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 module initialization, the file is considered closed, and %OPEN returns '0'.

For more information, see File Operations or Built-in Functions.

Figure 235. %OPEN Example
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
F*Filename+IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++
 * The printer file is opened in the calculation specifications
FQSYSPRT   O    F  132        PRINTER USROPN

 /FREE
    // Open the file if it is not already open
    if not %open (QSYSPRT);
       open QSYSPRT;
    endif;
 /END-FREE


[ Top of Page | Previous Page | Next Page | Contents | Index ]