Program considerations

You need to consider these rules and techniques when running the Open Query File (OPNQRYF) command from a command line or when writing CL or other high-level language programs that use the OPNQRYF command.

  • If you run the OPNQRYF command from a command entry line with the OPNSCOPE(*ACTGRPDFN) or TYPE(*NORMAL) parameter option, error messages that occur after the OPNQRYF command successfully runs will not close the file. Such messages would have closed the file prior to Version 2 Release 3 when TYPE(*NORMAL) was used. The system automatically runs the Reclaim Resources (RCLRSC) command if an error message occurs, except for message CPF0001, which is sent when the system detects an error in the command. However, the RCLRSC command only closes files opened from the default activation group at a higher level in the call stack than the level at which the RCLRSC command was run.
  • After running a program that uses the OPNQRYF command for sequential processing, the file position is normally at the end of the file. If you want to run the same program or a different program with the same files, you must position the file or close the file and open it with the same OPNQRYF command. You can position the file with the Position Database File (POSDBF) command. In some cases, a high-level language program statement can be used.