Special File Handling
*VIEW* View based file
  This functionality is a +PxPlus Exclusive
Formats OPEN (chan[,fileopt]) "*VIEW*;viewname[;options] [...]"

Where:

chan Channel or logical file number.
fileopt File options. Supported options for opening *VIEW* include:
ERR=stmtref Error transfer.
OPT=options Additional parameters (See options below).
viewname Defines the name of the View whose definition will determine the logical file contents.
options File options. Supported parameters separated by a semi-colon. These include:
KNO=Key number Key number to use for file access. Default is the key specified in the View definition.
IOL=Iolist Iolist to use when reading the file. Options are IOL=* to access the embedded iolist, or an iolist definition.
*VIEW* Case insensitive keyword. Special device file name, enclosed in quotation marks within OPEN directive. (Include asterisks in syntax.)
   
Description The *VIEW* interface allows a View to be used to define the contents of a logical file for use by an application program. It allows the program to access the contents of a View as if it were a standard read-only file.

Opening the View

To open the contents of a View, specify the file name *VIEW* followed by the name of the View you wish to access, separated by semi-colons.

OPEN (1) "*VIEW*;CustomerView"

When opened, the system will process the View definition and return its contents in a memory file using the specified channel number.

By default, the memory file will have an external key based on the key defined for the View. This can be changed by specifying the KNO= parameter in the OPEN statement. Also, by default there is no iolist, however, you can specify the IOL=* parameter to use the View's internal iolist, or specify an iolist definition such as IOL=IOLIST Acct$,CustName$,Balance.

OPEN (1)"*VIEW*;AcctInfoView;KNO=1;IOL=*"

OPEN (1,OPT="IOL=IOLIST This$,That$,Another",ERR=*NEXT)"*VIEW*;myView"

The contents of the returned memory file is a static data set for the specified View, that is, the file is a snapshot of the View results at the time the file was opened. No changes or updates to the original data sources are reflected in the file as it is processed. Closing the channel will free the memory file and free its contents.