11 5 Using the OPEN Command Instead of a Logical View to Order Data

LANSA Application Design

11.5 Using the OPEN Command Instead of a Logical View to Order Data

The use of the LANSA OPEN command with the parameter USE_OPTION(*OPNQRYF) to invoke the operating system command OPNQRYF (open query file) has already been discussed in relation to the production of flexible reporting programs.

This section describes how the KEYFLD parameter can be used to alter the order in which data is processed/printed by a report program.

Another aspect of this facility relates to total system performance.

When you are going to produce a report which must be ordered in a way that does not reflect the key of any existing logical file, you basically have 2 choices:

  • The first is to create a new logical file which enables the program to view the data in the way required to produce the new report.
  • The second is to use the OPEN USE_OPTION(*OPNQRYF) command to create a temporary access path which will enable you to view the data in the required order.

If the report is not commonly used, and there are less than 100,000 records in the file, the second is probably the preferred alternative, mainly because:

  • Creating a logical file with an immediately maintained access path puts additional load on all system users.
  • Even if the file has a deferred or rebuild style access path it will still mean continual system overheads - as well as causing LANSA to create a larger I/O module for the file.
  • An additional logical view becomes an additional burden whenever a system is being changed or maintained. It must be understood and accounted for by the person changing the system.