Start of change

COMPARE_IFS table function

The COMPARE_IFS table function returns differences between the specified integrated file system (IFS) objects. This can be a single object or a subtree of objects starting from a specified directory.

Either a name compare or a full attribute compare can be requested. When comparing attributes, one row is returned for each attribute that is different between a pair of objects. The attributes are a subset of the values returned by the QSYS2.IFS_OBJECT_STATISTICS and QSYS2.IFS_OBJECT_PRIVILEGES table functions.

If no differences are found for any objects, no rows are returned.

The integrated file system supports many file systems. Only those objects in the root (/) and QOpenSys file systems can be compared. Other file systems are not supported. The specified start-path-name1 and start-path-name2 must be in a supported file system or an error will occur.

Independent auxiliary storage pool (IASP) objects are supported. start-path-name1 and start-path-name2 can be within an IASP.

Authorization: The caller must have:
  • For each directory included in the path name used to start the compare, *X
  • For each directory processed recursively, *RX and *OBJMGT
  • For each object compared, *OBJMGT

The caller must have *ALLOBJ or *AUDIT special authority to compare the object auditing attributes for objects and directories. If the caller does not have this authority, a difference in these values will not be reported.

Any object for which the caller does not have sufficient authority will be treated as though it does not exist.

Read syntax diagramSkip visual syntax diagram COMPARE_IFS ( START_PATH_NAME1 =>  start-path-name1 , START_PATH_NAME2 =>  start-path-name2 ,RDB2 => rdb2,SUBTREE_DIRECTORIES => subtree-directories,OBJECT_TYPE_LIST => object-type-list,COMPARE_ATTRIBUTES => compare-attributes )
The schema is QSYS2.
start-path-name1
An expression that returns a path name for the first object of the comparison. A relative path name is relative to the current directory. If an absolute path name is not specified, the current working directory is used in combination with the relative path name to resolve to the object. The object must exist on the current server.
If start-path-name1 identifies an object, the single object is compared with the object provided by start-path-name2. If start-path-name1 identifies a directory, the directory and all objects included in the object-type-list within the directory are compared with the directory provided by start-path-name2. When comparing directories, the subtree-directories parameter determines whether the compare will process subdirectories.
start-path-name2
An expression that returns a path name for the second object of the comparison. A relative path name is relative to the current directory. If an absolute path name is not specified, the current working directory on rdb2 is used in combination with the relative path name to resolve to the object. The object must exist on the server implicitly or explicitly identified by rdb2.
rdb2
A character or graphic string expression that identifies the relational database where start-path-name2 exists.
If this parameter is omitted, start-path-name2 must exist on the current server.
subtree-directories
An expression that indicates whether all subdirectories are recursively compared. This parameter only applies when comparing directories. Otherwise, the value is ignored.
NO
The objects in the directory identified by start-path-name1 are compared to the objects in the directory identified by start-path-name2.
YES
All objects in all subdirectories for the directory identified by start-path-name1 are compared to the corresponding objects in start-path-name2. This is the default.
object-type-list
A list of one or more object types to be included in the compare. One or more blanks separate multiple values. The default is *ALL, indicating all object types are compared. Supported values are all of the root (/) and QOpenSys file system object types (*CHRSF, *DIR, *FIFO, *SOCKET, *STMF, *SYMLNK) and the following special values:
*ALL
Compare all root (/) and QOpenSys file system object types. These are *CHRSF, *DIR, *FIFO, *SOCKET, *STMF, and *SYMLNK.
*ALLSAV
Compare all root (/) and QOpenSys file system object types which can be saved using the Save (SAV) command. These are *CHRSF, *DIR, *FIFO, *STMF, and *SYMLNK.
compare-attributes
A string expression that indicates which attributes are compared for an object.
NAMES
Only the object names are compared. A row is returned for any name that is not found in both directories. This option is only allowed when comparing directories. This is the default.
YES
The attributes are compared for an object. A row is returned for each difference found.
The attributes compared for an object vary based upon the object type. Not all attributes are eligible to be compared.

The result of the function is a table containing rows with the format shown in the following table. All columns are nullable.

Table 1. COMPARE_IFS table function
Column Name Data Type Description
PATH_NAME1 DBCLOB(16M)
CCSID 1200
The full path name of the first object for the compare.
PATH_NAME2 DBCLOB(16M)
CCSID 1200
The full path name of the second object for the compare.
ATTRIBUTE_NAME VARGRAPHIC(512)
CCSID 1200
The name of an object attribute that is not identical.
VALUE1 VARGRAPHIC(2048)
CCSID 1200
The attribute value for the first object.
VALUE2 VARGRAPHIC(2048)
CCSID 1200
The attribute value for the second object.

Examples

  • Compare the attributes for all objects in two subtrees. Do not look within any subdirectories.
    SELECT * FROM TABLE(QSYS2.COMPARE_IFS(
                                           START_PATH_NAME1  => '/usr', 
                                           START_PATH_NAME2  => '/usrbackup',
                                           SUBTREE_DIRECTORIES => 'NO',
                                           COMPARE_ATTRIBUTES  => 'YES'
                                  ));
  • Compare the names for all objects in two subtrees. Compare recursively through the entire set of subdirectories.
    SELECT * FROM TABLE(QSYS2.COMPARE_IFS(
                                           START_PATH_NAME1    => '/usr/files.dir', 
                                           START_PATH_NAME2    => '/usrbackup/files.dir',
                                           SUBTREE_DIRECTORIES => 'YES',
                                           COMPARE_ATTRIBUTES  => 'NAMES'
                                  ));
  • Compare the attributes for all stream file objects recursively.
    SELECT * FROM TABLE(QSYS2.COMPARE_IFS(
                                           START_PATH_NAME1    => '/usr/files.dir', 
                                           START_PATH_NAME2    => '/usrbackup/files.dir',
                                           OBJECT_TYPE_LIST    => '*STMF',
                                           SUBTREE_DIRECTORIES => 'YES',
                                           COMPARE_ATTRIBUTES  => 'YES'
                                  ));
End of change