catalog/sysfiles
The catalog/sysapps table contains metadata for app name objects on a path for a select object type. The default is for file type MASTER (Master Files), but is settable for other types. Unless limited in some way, all objects (of the selected type) are displayed.
This section only touches on basic uses typically needed by a developer. The Master File on disk robustly describes more attributes than are described here. You can directly study it in order to understand other uses. The catalog/sys* group of files are subject to change (and are usually upwardly compatible). You should never write applications that have specific dependencies (typically on object size), which tend to cause upward compatibility issues.
Listing APP MASTER Objects
The following request lists file names, file names with their application paths, and extensions of files with file type MASTER (the default):
TABLE FILE SYSFILES PRINT FILENAME LGNAME PHNAME EXTENSION END
The output (with some records and whitespace selectively removed for readability) is:
FILENAME LGNAME PHNAME EXTENSION -------- ------ ------ --------- ... mydata MASTER baseapp/mydata.mas mas mdschema MASTER _edahome/catalog/mdschema.mas mas
Listing APP FOCEXEC Objects
The following request sets the file type to FOCEXEC and then prints the file names, file names with their application paths, and extensions of files with file type FOCEXEC:
SQL FMI SET SYSFILES FOCEXEC TABLE FILE SYSFILES PRINT FILENAME LGNAME PHNAME EXTENSION END
The output (with some records and whitespace selectively removed for readability) is:
FILENAME LGNAME PHNAME EXTENSION -------- ------ ------ --------- ... myproc1 FOCEXEC baseapp/myproc1 fex myproc2 FOCEXEC baseapp/myproc2 fex ...
Note: The value for LGNAME will switch to DEFAULT if the data is limited and only one object returns.
A valid value for the SQL FMI SET SYSFILES command is any valid FOCUS file type. Some examples are FOCUS, FOCEXEC, STY, PDF, or ACCESS. For a full list of valid file types, see Designating File Types for APP Commands.
Using the SYSFILES Table to Check File Existence
The following practical example of using the SYSFILES table to check file existence prints the filename myproc1 with extension fex (with the file type set to FOCEXEC). If no lines are returned, the file does not exist and the procedure exits. If the file exists, the procedure transfers to the point at which processing continues.
SQL FMI SET SYSFILES FOCEXEC TABLE FILE SYSFILES PRINT FILENAME ON TABLE HOLD WHERE FILENAME = 'myproc1' ; WHERE EXTENSION = 'fex' ; END -IF &LINES GT 0 THEN GOTO RESUME -TYPE Procedure Not Found ... exiting! -EXIT -RESUME