Monday, 29 July 2013

Easytrieve Library.

EasytrieveLibrary

FILE Statement

The FILE statement describes an input or output file and is coded in the Library section of an EASYTRIEVE PLUS program. The syntax of the FILE statement is determined by the type of system you are using to run EASYTRIVE PLUS programs.




Virtual File Manager (VFM)

VFM provides an easy method for establishing temporary work files without special job control or file allocation statements. VFM is a sequential access method for program work files. It dynamically allocates space in memory for work files when sequencing a report or when producing multiple reports.
  • When a virtual file is read back into the program, space is released and becomes available for reuse unless you code RETAIN on the statement.
  • If the area in memory (default is 16k) is exhausted, VFM writes the excess data to a single spill area on disk.
              FILE    file-name    F  (lrecl)    VIRTUAL   [ RETAIN ]

F (lrecl) designates the record length.

VIRTUAL causes the file to be created and maintained by the VFM.

RETAIN causes VFM files to be retained for the duration of the EASYTRIEVE PLUS program execution.

COPY Statement

The COPY statement duplicates the field definitions of a named file. You can code an unlimited number of COPY statements for any one file.

COPY { file-name }
When the same field-name is used in more than one file in the same activity, you must qualify duplicate field-names by adding the file-name as a prefix separated by a colon.
Example

FILE INONE
         FLD-ONE            10      1      A
         FLD-TWO           11      3      N
FILE INTWO
-->     COPY       INONE
JOB  INPUT   INTWO     NAME    COPY-EXAMPLE
        IF  INTWO:  FLD-ONE
** Logic **

EXIT parameter

The EXIT parameter on the FILE statement invokes a user routine for every input or output operation for that file.
  • You use EXIT to access a routine that converts non-standard data files that EASYTRIEVE PLUS does not process directly.
  • EXIT is not valid for VFM or IMS / DLI. (IMS / DLI information is contained in APPENDIX D of this Student Guide.)
FILE   file-name    [EXIT (program-name [NR]                   +
          USING ( field-name … )         [ MODIFY ] ) ]

NR has meaning only in DOS; NR indicates that the program is non-relocatable.

USING specifies the parameters to be passed.

MODIFY specifies that the exit can inspect and modify each record after input or before output.


No comments:

Post a comment