|
|
Accessing Files Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 14 Getting File InformationRetrieving Specific File Information |
|
The LISTFILE, LISTFILE...;TEMP and LISTEQ commands return formatted information to your job or session list device. If you need to retrieve specific information about a particular file, and you wish to place it in a variable available either to your CI or to your program, then you'll be interested in the the CI evaluator function and intrinsics described below.
You can use the FINFO evaluator function interactively to retrieve information about a specified file. FINFO is a function of the expression evaluator, a system procedure used by the IF, WHILE, SETVAR, and CALC commands of the command interpreter. FINFO has two parameters. The first is the file name of the file about which you wish to obtain information; this is a string, and must be either a fully or partially qualified file name, or a FILE equation backreference. The second parameter is an integer or integer expression that indicates the nature of the information required. The options available are listed in Table 14-2 “FINFO Options”. Table 14-2 FINFO Options
The example below shows the steps you can use to retrieve the following information about a file:
Use this intrinsic to retrieve information about a specified file. The file can be on any device, but it must be opened by the calling process at the time of the FFILEINFO call. If you wish to return label information from a file that is not opened, use FLABELINFO instead. FFILEINFO has one required parameter, filenum. This is the file number, which is returned when you open a file using FOPEN or HPFOPEN. You can specify the information that you wish to be returned by using up to five itemnum,item pairs. Each itemnum designates a type of information (for example, logical device number, name of file creator, or volume ID), which is then returned in the item parameter. The itemnums can be specified in any order. Here is an example of an FFILEINFO intrinsic call. The information returned in this example is the same information retrieved in theFINFO example above:
Here is a description of the information returned in the parameters specified in the above FFILEINFO call:
A complete description of the information that you can obtain using FFILEINFO is given in the MPE/iX Intrinsics Reference Manual (32650-90028). This intrinsic, which returns some of the same information as FFILEINFO, is an MPE V/E-based intrinsic that is currently supported only for compatibility reasons. When you use a call to FGETINFO, MPE/iX now calls FFILEINFO to retrieve the file information. For this reason, it is advisable for you to call FFILEINFO directly; however, there is no need to rewrite existing programs that use FGETINFO unless there is a performance problem. Here is an example of an FGETINFO intrinsic call that is the exact equivalent of the FFILEINFO example shown above:
A complete description of the information that you can obtain using FGETINFO is given in the MPE/iX Intrinsics Reference Manual (32650-90028). The FLABELINFO intrinsic returns information from the file label of a disk file. The file need not be opened at the time of the intrinsic call. The information returned by this intrinsic is a subset of the information returned by FFILEINFO. Here is an example of a FLABELINFO intrinsic call that returns the same information as the FFILEINFO and FGETINFO examples shown above:
The ITEMS parameter above is a record structure, exactly 36 bytes in length, that can be declared in the following manner:
A complete description of the information that you can obtain using FLABELINFO is given in the MPE/iX Intrinsics Reference Manual (32650-90028). |
|