<file options>
┌◄────────────────────────┐ ── { ─┴─┬─<select expression>─┬─┴─ } ──────────────────────────────────┤ ├─<show expression>───┤ ├─<sort expression>───┤ └─<search expression>─┘
SELECT Expression
── SELECT ──<file attribute expression>────────────────────────────────┤
SHOW Expression
┌◄───────────────────────────────┐ ── SHOW ─┴─┬─<file attribute>────────────┬┴────────────────────┤ ├─<file attribute expression>─┤ ├─ ALL ───────────────────────┤ └─ ALLP ──────────────────────┘
SORT Expression
┌◄─────────────────────────┐ ── SORT ─┴─┬─ + ─┬─<file attribute>─┴──────────────────────────────────┤ └─ - ─┘
SEARCH Expression
── SEARCH ─┬─ RESIDENT ─────┬──────────────────────────────────────────┤ ├─ NONRESIDENT ──┤ ├─ ALL ──────────┤ ├─ CDROM ────────┤ └─ USERCODEONLY ─┘
<file attribute expression>
┌◄───────────────────┬── AND ─┬────────────────────┐ │ └◄─ OR ──┘ │ ──┴─<file attribute>─┬─ = ──┬─<file attribute value>─┴─────────────────┤ ├─ != ─┤ ├─ <> ─┤ ├─ >= ─┤ ├─ <= ─┤ ├─ > ──┤ └─ < ──┘
Explanation
Files that have certain values for file attributes can be listed. You can set criteria for certain file attributes to list the files you want. File attributes such as FILEKIND, SECURITYTYPE, SECTORS, and so on can be specified to list certain files.
The expressions you can use to select files by file attributes are
-
SELECT expression
-
SHOW expression
-
SORT expression
-
SEARCH expression
The file option expressions are applied to the list of files selected in any of the methods (by directory node, wild-card character, pattern matching, or file attributes) described in this section. Any or all of the file option expressions can be applied to the files list.
All file option expressions must be enclosed within braces ({ }).
Displaying File Attributes
When you select file attributes with the SELECT, SEARCH, SORT, or SHOW expressions, you can choose the format in which file attributes are displayed by specifying an output option of either LONGFORMAT or SINGLELINE.
If you choose LONGFORMAT, the format of the file names and selected file attributes is as follows:
<1st file name> <file attribute 1>=<value> <file attribute 2>=<value> <file attribute 3>=<value> <file attribute 4>=<value> <2nd file name> <file attribute 1>=<value> <file attribute 2>=<value> <file attribute 3>=<value> <file attribute 4>=<value> . . . . . . . . . <number> Files found
If you choose SINGLELINE, the format of the file names and selected file attributes is as follows. If more than five file attributes are selected (including the file name, which is always returned), the LONGFORMAT format is used.
FILE NAME <attrib 1> <attrib 2> <attrib 3> <attrib 4> ----------------------------------------------------------------- <file name> <value> <value> <value> <value> . . . . . . . . . . . . . . . <number> Files found
If you choose neither display output option, then the following format is used with the values for the file attributes FILEKIND, RECORDS, SECTORS, and CREATIONTIME:
FILE NAME FILEKIND RECORDS SECTORS CREATIONTIME ----------------------------------------------------------- <file name> <value> <value> <value> <value> . . . . . . . . . . . . . . . <number> Files found
CANDE does not place any restriction on the file attribute value. In the following example, the date February 29, 2001 is listed:
FILES ON APT {SELECT CREATIONTIME = 20010229} #NO MATCHING FILES FOUND #
Although 2001 is not a leap year, CANDE accepts the date without issuing an error or warning message. CANDE issues the following message:
#NO MATCHING FILES FOUND
Listing Files with the SELECT Expression
The SELECT expression selects files based on the specified values given for file attributes.
<file attribute expression>
A SELECT expression can be made up of a single file attribute expression or multiple file attribute expressions.
A file attribute expression assigns a value to a file attribute; if several file attribute expressions are specified, they are connected by a logical AND or logical OR operator.
The following operators assign file attribute values to file attributes or group file attributes in execution-precedence order:
-
= (equal sign)
The equal sign (=) assigns the file attribute value to the file attribute.
-
!= (not-equal sign)
The not-equal sign (!=) excludes the file attribute value for the file attribute.
-
< > (not-equal sign)
The not-equal sign (<>) is the same as the not-equal sign (!=).
-
>= (greater-than-or-equal-to sign)
The greater-than-or-equal-to sign (>=) assigns the file attribute values to the file attribute.
-
<= (less-than-or-equal-to sign)
The less-than-or-equal-to sign (<=) assigns the file attribute values to the file attribute.
-
> (greater-than sign)
The greater-than sign (>) assigns file attribute values greater than the specified value to the file attribute.
-
< (less-than sign)
The less-than sign (<) assigns file attribute values less than the specified value to the file attribute.
-
AND
The logical operator AND groups two or more file attribute assignments. The AND logical operator is secondary in order of precedence to the OR logical operator.
-
OR
The logical operator OR groups two or more file attribute assignments. The OR logical operator is primary in order of precedence to the AND logical operator.
Because the OR logical operator has a higher order precedence than the AND logical operator, and the parentheses cannot be used to group file attribute assignments for higher order precedence, you must be careful when combining several file attribute assignments.
The following example shows how a SELECT expression is interpreted when multiple file attributes (represented as A, B, C, D, E, and F) are specified:
A OR B AND C OR D OR E AND F (A OR B) AND (C OR D OR E) AND F
Note: | Parentheses are not permitted in a SELECT expression. |
The file attribute value can be Boolean, integer, real, or string-valued, depending on the type of file attribute specified. The uppercase letters of the file attribute names are the minimum abbreviation in a file attribute expression.
Many of the file attributes that are available for use with the SELECT, SHOW, and SORT options of the FILES command are accessed through the MCP interface ASERIES_INFO procedure. Because the file attributes are not always mapped directly to standard ClearPath file attributes, it is recommended that you refer to the MCP System Interfaces Programming Reference Manual for the correct format when entering a file attribute expression. Refer to the File Attributes Programming Reference Manual for a description of the file attributes.
The following file attributes can be specified in SELECT, SHOW, or SORT expressions:
ALtertime |
AREALength |
AREAS |
AREASEctors |
AREASINuse |
Blocksize |
Bytes |
CODEVersion |
COMPILERMark |
COMPILERCycle |
CONtrol |
COREestimate |
CREationtime |
CRUnched |
Cycle |
EXEcutetime |
EXECUTIoncount |
EXTmode |
EXTMODEValue |
FAmilyname |
FILEkind |
FILEKINDValue |
FILEOrg |
FILEStructure |
FILESTRUCTUREValue |
FILEType |
FRamesize |
INuse |
KERberos |
LAstaccesstime |
LEvels |
LOCKed |
LOCKEDFile |
MAxrecsize |
MInrecsize |
NAme |
NOte |
ONEonly |
PU |
PUTrans |
RECord |
RELeaseid |
RESTrictedfile |
SAvefactor |
SECadmin |
SECADMINTrans |
SECTors |
SECURITYGuard |
SECUritytype |
SECURITYTYPEValue |
SECURITYUse |
SECURITYUSEValue |
SENsitive |
STACksize |
SUPpressed |
TASKing |
TASKINGTrans |
TImestamp |
UNits |
UNITSValue |
USerinfo |
VErsion |
The following granulated-privileges file attributes can be specified in SELECT, SHOW, or SORT expressions:
GPCHange |
GPCHANGETrans |
CPCHANGESec |
GPCHANGESECTrans |
GPCREatefile |
GPCREATEFILETrans |
GPExecute |
GPEXECUTETrans |
GPGETstatus |
GPGETSTATUSTrans |
GPGSDirectory |
GPGSDIRECTORYTrans |
GPIdc |
GPIDCTrans |
GPLOCalcopy |
GPLOCALCOPYTrans |
GPLOGInstall |
GPLOGINSTALLTrans |
GPLOGOthers |
GPLOGOTHERSTrans |
GPRead |
GPREADTrans |
GPREMove |
GPREMOVETrans |
GPSETstatus |
GPSETSTATUSTrans |
GPSYStemuser |
GPSYSTEMUSERTrans |
GPUserdata |
GPUSERDATATrans |
GPWrite |
GPWRITETrans |
ALL and ALLP can be included in a SHOW expression. If either are included, all other attributes are ignored. If both are included, ALLP is ignored.
If you specify ALL, most of the attributes are displayed. Among the attributes that are not shown are those for which both a mnemonic and a value exist. For example, ALL reports the mnemonic values of FILEKIND and SECURITYTYPE, but does not report the values for FILEKINDVALUE and SECURITYTYPEVALUE.
If you specify ALLP, the attributes that indicate code file privileges are displayed.
Listing Files with the SORT Expression
The SORT expression controls the listing order of files that are chosen by a wild-card expression or SELECT expression.
The SORT expression sorts the selected files by the file attribute values. The plus sign (+) or minus sign (-) preceding the SORT expression sorts the file list in ascending or descending order, respectively.
If multiple file attributes are specified, the files are sorted first by the first file attribute specified, second by the next file attribute specified, and so on for each specified file attribute.
The SORT expression must be delimited by braces ({ }) and immediately follow the file name specification.
If a SORT expression is not used, files are listed in the order that the directory search function returns to CANDE.
Examples of the SORT Expression
The following example sorts a file first by FILEKIND in ascending order and second by FILENAME in descending order:
FILES = {SORT + FILEKIND - NAME}
The following example sorts all ALGOL symbol files by FILEKIND in ascending order:
FILES = {SELECT FILEKIND = ALGOLSYMBOL SORT + FILEKIND}
Listing Files with the SEARCH Expression
The SEARCH expression enables you to specify the following options:
-
RESIDENT
The RESIDENT option searches only for resident files.
-
NONRESIDENT
The NONRESIDENT options searches only for non-resident files.
-
ALL
The ALL option searches for both resident and non-resident files.
-
CDROM
The CD-ROM option searches for files on a CD-ROM reader.
-
USERCODEONLY
The USERCODEONLY option inhibits the secondary search of the system for nonusercoded files.
The SEARCH expression must be delimited by braces ({ }) and specified immediately after the file name specification.
Example of the SEARCH Expression
FILES = {SHOW FILEKIND NAME SEARCH USERCODEONLY}
The following statement displays only the file names and FILEKIND attribute for each file that resides under the user's directory.
Listing Files with the SHOW Expression
The SHOW expression enables you to specify the file attributes to display. Although the file name attribute is always displayed first, other file attributes are displayed in the order specified.
<file attribute expression>
The file attribute expression is the same as that for the SELECT expression. The file attribute expression is permitted in a SHOW expression to both select and display the file attributes of selected files. A separate SELECT expression is unnecessary.
Examples of the SHOW Expression
The following example shows only the file name and file kinds for the chosen files:
FILES = {SHOW FILEKIND NAME}
The following example displays the file name and number of records for all ALGOL symbol files that have more than 23 records.
FILES = {SELECT FILEKIND = ALGOLSYMBOL SHOW RECORDS > 23}
Examples
FILES (AVERAGEUSER) ON DISK . AFILE . . A1 : SEQDATA . . A2 : SEQDATA . BFILE . . B1 : SEQDATA . . B2 : SEQDATA . CFILE : SEQDATA # files : 1 (AVERAGEUSER) ON DISK . AFILE . BFILE . CFILE : SEQDATA #
File Security
The following security issues control which files and directories can be seen using the FILES command:
If you are
-
A privileged user, you can see files and directories that do not belong to you.
-
Not a privileged user, you can see files and directories that do not belong to you if the files are marked PUBLIC and the usercode that owns the files has the value SHOWFILES specified in the USERDATAFILE.
The SHOWFILES option will also enable non-privileged users to specify the number of subdirectory levels that the user wants to view. If no files are found within the specified levels, no files or subdirectories are displayed. The following table provides examples of what a non-privileged user could view for a public file (U)A/B/C/D.
The FILES command . . . |
Enables the user to view . . . |
FILES (U) : 3 |
A/B/C |
FILES (U) : 1 |
A |
FILES (U) : 2 |
A/B |