Temporary versus Permanent Files
For every disk-based or memory-based file you define in the APPX dictionary, you must designate whether the file is temporary or permanent. This distinction affects how and/or when a file is created, opened, and scratched (see Table 2-1-5).
· Temporary files provide working space that is unique to a task and automatically managed by APPX during processing. At its maximum, the existence of a temporary file is limited to a single APPX session. If, based upon a file’s specifications, it is not shared between processes, the existence of a file may be considerably less than the length of a session. Temporary files are database-independent; there is only one copy of a file for all databases that access it. Temporary files are never shared between users.
· Permanent files, on the other hand, are always shareable between processes, and are managed by APPX’s database management. APPX never automatically scratches permanent files. If a file is disk-based, each database has its own copy of it; permanent, disk-based files are database-dependent. They are always shared between processes, regardless of file specifications.
Permanent files are created by APPX’s database management. See the System Management Manual for more information.
Attribute |
Permanent File |
Temporary File |
Shared Between databases |
No, except with statements |
Yes |
Shared between processes |
Always |
Dependent upon file specs |
Shared between users |
Yes |
No |
Outlasts a single session |
Yes |
No |
Requires Database Management specifications |
Yes |
Yes, if disk-based. No, if memory-based |
Table 2-1-5. A Comparison between Temporary and Permanent Files
Temporary files are created when a process that references the file begins. By using a CREATE statement, you exercise explicit control over the time when a temporary file is created. For example, you can define a CREATE statement in a Start of Process event point to force APPX to create the file at the beginning of the process.
APPX never automatically opens temporary or permanent files at the beginning of a process. To enhance perceived performance (and quite often actual performance), APPX distributes file openings throughout a process. A file is physically opened when APPX first needs to access the file. By using an OPEN statement, you exercise explicit control over the time when a file is opened. For example, you can define an OPEN statement in a Start of Process event point to force APPX to open a file at the beginning of the process.
Any process can be invoked as DETACHED or related, or as a SUBPROCESS. When working with temporary files, it is important to know how the file type and the process invocation are related and interact. See Chapter 1-5 for information about Interprocess Communication in APPX.
If APPX does not know for sure that a file exists, it attempts to open the file during the execution of a process. File Does Not Exist error messages can therefore occur at any time during process execution, unless all files are explicitly opened at the beginning of the process. The obvious trade-off is decreased performance.