COMPARE Command File

Explains how to code a COMPARE command file to use with the MFTestConversion command, IN parameter.

Syntax:

USE DB2;
SELECT arguments;
USE SRV;
SELECT arguments;
COMPARE [integer ROWS] [SKIP COL integer1 [integer2 ...]]
[USE DB2;
SELECT arguments;
USE SRV;
SELECT arguments;
COMPARE [integer ROWS] [SKIP COL integer1 [integer2 ...]]
[...]]

Parameters:

USE DB2
Execute the following SQL SELECT command against the DB2 connection specified on the MFTestConversion command line.
USE SRV
Execute the following SQL SELECT command against the SQL Server connection specified on the MFTestConversion command line.
SELECT arguments
Any valid SQL SELECT statement returning a set of values to be compared. Each SELECT statement applies to the database specified in the USE statement that immediately precedes it. You must code at least one SELECT statement corresponding to the preceding USE DB2 and USE SQL statements respectively before coding a COMPARE statement. The returned values for both SELECT statements preceding a COMPARE statement should include the same list of columns in the same order to ensure success. Qualifiers for table names and column names can differ, depending on how the tables are defined in their respective databases.
COMPARE
With no arguments, compares all rows and all columns in the result sets for each preceding SELECT statement.
integer ROWS
Compare only the first integer rows, where integer represents any number greater than zero (0).
SKIP COL integer [integer ...]
Do not return compare information for each column number specified by integer, where integer represents any number greater than zero (0) and less than the number of columns in the SELECT list or 749; separate each specified integer with a space.

Comments:

Code a COMPARE command file using any text editor and save with the filename of your choice in either the directory specified by the Local HCOSS Directory or the directory specified by the Shared HCOSS Directory HCOSS option.

You can code multiple comparisons into a single COMPARE command file.

USE and COMPARE commands and their respective arguments are not case sensitive.

SQL SELECT statements might be case sensitive depending on how the database handles case sensitivity.

You can combine the ROWS and SKIP COL options.

Synonyms for COL are:
  • COLUMN
  • COLUMNS
  • COLS

Examples:

Compare all returned tables and rows:
USE DB2;
SELECT * FROM EMPINFO2;
USE SRV;
SELECT * FROM EMPINFO2;
COMPARE;
Compare a limited number of rows:
USE DB2;
SELECT * FROM EMPINFO2;
USE SRV;
SELECT * FROM EMPINFO2;
COMPARE 10 ROWS;
Skip certain columns:
USE DB2;
SELECT * FROM EMPINFO2;
USE SRV;
SELECT * FROM EMPINFO2;
COMPARE SKIP COLS 3 5 15;
Compare a limited number of rows and skip certain columns:
USE DB2;
SELECT * FROM EMPINFO2;
USE SRV;
SELECT * FROM EMPINFO2;
COMPARE 10 ROWS SKIP COLS 3 5 15;
Include more than one comparison in a single COMPARE command file:
USE DB2;
SELECT * FROM EMPINFO2;
USE SRV;
SELECT * FROM EMPINFO2;
COMPARE 10 ROWS SKIP COLS 3 5 15;
USE DB2;
SELECT * FROM EMPINFO3;
USE SRV;
SELECT * FROM EMPINFO3;
COMPARE;