![]() Using a Subfile |
![]() Virtual Machine |
![]() |
Although a Subfile is not accessible as a variable within PROIV, it behaves exactly like another File Variable to any 'parent' definition that contains it as an S-type field. If modified Subfile contents are to be saved, the parent record must be read before any Subfile records are read. PROIV internally ensures that parent records are written after Subfile records to allow usage of Subfiles as secondary files.
If the parent record is not accessed in Add or Change mode, or if the update of the parent record is deselected, then all modifications to the Subfile are lost when the PROIV Function terminates.
If a single process attempts to lock and read a subrecord that is already locked within the same function, a deadlock results; this can be exited by pressing the BREAK key.
This example shows the File Definitions for a Reality file and an associated Subfile, and the screen field and characteristics definitions that use these files.
The screenshot below shows the Reality File Definition, ACTIVITY, which contains details of the various activities at a sports centre. One of the attributes, NUMATTS is a Subfile containing the number of attendees at each session of the activity; there are values (subrecords) for each session and, within each value, the number of attendees is held in two subvalues - one for the number of sports centre members and one for the number of non-members.
Screenshot shows the example ACTIVITY Reality File Definition
Note: The record length calculated by PROIV does not include any allowance for the contents of the Subfile.
Screenshot shows the example NUMATTS Subfile File Definition
Topic ID: 720273