File placement policy syntax

This topic describes the syntax conventions for file-placement rules.

You can create a file containing policy rules for placing newly created files. You can then use this rule file when creating a policy using the mkpolicy command from the administrative CLI. You can also edit the policy rules that you create using the SAN File System console.

Note:
  1. Every policy file must start with VERSION 1.
  2. A policy is not required to contain any rules, in which case it would be equivalent to the default policy.
  3. The maximum size of a policy is 32 KB.

You can also add comments to the policy. All comments must start with /* and end with */ (for example, /* comment */).

Read syntax diagramSkip visual syntax diagram
>>-RULE--+-------------+--SET--STGPOOL--'pool_name'------------->
         '-'rule_name'-'

>--+--------------------------------------------+--------------->
   |                      .-,--------------.    |
   |                      V                |    |
   '-FOR----FILESET----(----'fileset_name'-+--)-'

>--+-----------------------+-----------------------------------><
   '-where--SQL_epxression-'

Parameters

RULE
Initiates the rule statement.
'rule_name'
Identifies the rule. This parameter is optional.
SETSTGPOOL 'pool_name'
Identifies the pool in which you want to place all files that match the rule criteria (fileset and SQL expression).
FOR FILESET ('fileset_name')
Identifies one or more filesets in which the file is created to determine where the file is to be placed. In the case of nested filesets, the rules apply if the file is created in the innermost fileset.
where SQL_expression
Compares the file attributes specified in the rule with the attributes of the file being created to determine where the file is to be placed. The SQL_expression can be any combination of standard SQL-syntax expressions, including comparison predicates, between predicates, in predicates, like predicates, mathematical value expressions, and boolean, string and numeric literals.
Note: Case expressions and compared-when clauses are not allowed.

SAN File System supports built-in functions, which can be used in comparison predicates, between predicates, in predicates, and like predicates. These functions are organized in three categories: date and time manipulation, numeric calculations, and string manipulation.

Attributes

You can use any of these attributes in the expression:
NAME
Name of the file. You can use a % wildcard in this name to represent zero or more characters and use the _ wildcard to represent a single character.
CREATION_DATE
Date and time that the file was created.
GROUP_ID
Numeric group ID. This attribute is valid only for AIX® clients.
USER_ID
Numeric user ID. This attribute is valid only for AIX clients.

String functions

You can use these string-manipulation functions on file names and literals.

Note: You must enclose strings in single-quotation marks. You may include a single-quotation mark in a string by using two single-quotation marks (for example, 'a''b' represents the string a'b).
CHAR(x)
Converts an integer x to a string.
CHARACTER_LENGTH(x)
Determines the number of characters in string x.
CHAR_LENGTH(x)
Determines the number of characters in string x.
CONAT(x,y)
Concatenates strings x and y.
HEX(x)
Converts an integer x in hexadecimal format.
LCASE(x)
Converts string x to lowercase.
LEFT(x,y,z)
Left justifies string x in a field of y characters, optionally padding with character z.
LENGTH(x)
Determines the length of the data type of string x.
LOWER(x)
Converts string x to lowercase.
LTRIM(x)
Removes leading blank characters from string x.
POSITION(x IN y)
Determines the position of string x in string y.
POSSTR(x,y)
Determines the position of string y in string x.
RIGHT(x,y,z)
Right justifies string x in a field of y characters, optionally padding with character z.
RTRIM(x)
Removes the trailing blank characters from string x.
SUBSTR(x FROM y FOR z)
Extracts a portion of string x, starting at position y, optionally for z characters (otherwise to the end of the string).
SUBSTRING(x FROM y FOR z)
Extracts a portion of string x, starting at position y, optionally for z characters (otherwise to the end of the string).
TRIM(x)
Trims blank characters from the beginning and end of string x.
TRIM(x FROM y)
Trims blank characters that are x (LEADING, TRAILING, or BOTH) from string z.
TRIM(x y FROM z)
Trims character y that is x (LEADING, TRAILING, or BOTH) from string z.
UCASE(x)
Converts the string x to uppercase.
UPPER(x)
Converts the string x to uppercase.

Numerical functions

You can use these numeric-calculation functions to place files based on either numeric parts of the file name, numeric parts of the current date, and AIX-client user IDs or group IDs. These can be used in combination with comparison predicates and mathematical infix operators (such as addition, subtraction, multiplication, division, modulo division, and exponentiation).
INT(x)
Converts number x to a whole number, rounding up fractions of .5 or greater.
INTEGER(x)
Converts number x to a whole number, rounding up fractions of .5 or greater.
MOD(x,y)
Determines x % y.

Date and time functions

You can use these date-manipulation and time-manipulation functions to place files based on when the files are created at the client and the local time of the subordinate metadata server serving the directory within which the file is being created.

CURRENT DATE
Determines the current date on the subordinate metadata server.
CURRENT_DATE
Determines the current date on the subordinate metadata server
CURRENT TIME
Determines the current time on the subordinate metadata server.
CURRENT_TIME
Determines the current time on the subordinate metadata server.
CURRENT TIMESTAMP
Determines the current date and time on the subordinate metadata server.
CURRENT_TIMESTAMP
Determines the current date and time on the subordinate metadata server.
DATE(x)
Creates a date out of x.
DAY(x)
Creates a day of the month out of x.
DAYOFWEEK(x)
Creates the day of the week out of date x, where x is a number from 1 to 7 (Sunday=1).
DAYOFYEAR(x)
Creates the day of the year out of date x, where x is a number from 1 to 366.
DAYS(x)
Determines the number of days since 0000-00-00.
DAYSINMONTH(x)
Determines the number of days in the month from date x.
DAYSINYEAR(x)
Determines the day of the year from date x.
HOUR(x)
Determines the hour of the day (a value from 0 to 23) of time or timestamp x.
MINUTE(x)
Determines the minute from date x.
MONTH(x)
Determines the month of the year from date x.
QUARTER(x)
Determines the quarter of year from date x, where x is a number from 1 to 4 (for example, January, February, and March is quarter 1).
SECOND(x)
Returns the seconds portion of time x.
TIME(x)
Displays x in a time format.
TIMESTAMP(x,y)
Creates a timestamp (date and time) from a date x and optionally a time y.
WEEK(x)
Determines the week of the year from date x.
YEAR(x)
Determines the year from date x.

Time and dates formats

Use any of the these formats when specifying times and dates.

Note: All date and time attributes in these rules are based in coordinated universal time (UTC).
Timestamp
Use one of the following formats to specify a timestamp:
  • date time
  • date

There must be exactly one space between the date and time.

You can mix formats for the date and time. For example, you can specify ISO format for the date and international format for the time.

Date
Use one of these formats to specify a date:
European
DD.MM.YYYY
ISO
YYYYMMDD
USA
MM/DD/YYYY

You may leave off leading zeros from MM (month) and DD (day). You can use a two-digit year, in which case 1900 is added if the year is greater than 50 and 2000 is added if the year is 50 or less.

Note: The MONTHNAME() and DAYNAME() functions produce English names with no internationalization.
Time
Use one of these formats to specify a time:
International
HH:MM[SS[.UUUUUU]]
USA
HH[:MM[:SS]] [A|P|AM|PM]

You may leave off leading zeros from any field except subseconds. The international format uses a 24–hour clock. The USA format uses a 12–hour clock followed by A, P, AM, or PM.

You can substitute commas or periods for colon delimiters in the international format.

Examples

The following example shows a sample file.

VERSION 1

rule 'stgRule1' set stgpool 'pool1' for fileset ('cnt_A')
rule 'stgRule2' set stgpool 'pool2' where NAME like '%.doc'
rule 'stgRule3' set stgpool 'pool3' where DAYOFWEEK(CREATION_TIME) == 1
rule 'stgRule4' set stgpool 'pool4' where USER_ID <= 100

Parent topic: Reference

Related concepts
Policies and rules

Related tasks
Creating a policy

Terms of use | Feedback
(C) Copyright IBM Corporation 2003, 2004. All Rights Reserved.