DIFF

Synopsis

HELP:   Compare archive content with another archive or version
TYPE:   OBJECT
SYNTAX: DIFF(FROM/READ(),COMPARE.{},FULLY,OFFSET,WINDOW[=num],REPORT='str'/STDOUT/STDERR,LOGGING.{},MESSAGE(),NORUN)

Description

The DIFF command uses all reading capabilities of the archive command to compare the clear net content of two data sources independent of the data format and representation. The comparison takes place on a logical level, based on the neutral FLAM5 elements.

By default (WINDOW=0), the DIFF function performs a simple sequential comparison: element N in source 1 is compared with element N in source 2. Insertions or deletions are not recognized; if one element more or less appears in one of the sources, the comparison will fail for the whole rest.

If you activate the 'WINDOW' switch (or set WINDOW=N), a BFS (Breadth-First Search) based resync look-ahead is used. After a mismatch, the comparison tries to find a matching element within a look-ahead window and groups consecutive differences into multi-element hunks. This allows insertions and deletions to be detected and reported correctly. Specifying WINDOW without a value (WINDOW=1) uses the natural block or matrix size derived from the archive member statistics as the window. Specifying WINDOW=N uses an explicit window of N elements. The maximum supported window size is 65536 (FLMSTD_MAX_DIFF_WINDOW); larger values are clamped to this limit automatically.

As an example, the DIFF command can be used to compare the logical content of an older version of an archive or parts of them (match) with a newer one.

Depending on the data formats, a dedicated method is used, to compare the logical data elements in the matrix. If a compare of the data formats makes no sense (XML elements or with text rest matrix) then an error is issued.

With the switch 'FULLY' you can activate additional checks depending on the data formats, for example:

If you want to verify that two files are identical independent of the platform and representation, then don't use this switch.

FULLY and cross-type record comparison

When both sources contain record-oriented matrix types (standard records, text records, text streams, relative records, etc.), a cross-type comparison is supported:

TXTRST data contains two raw elements per logical record: the data element (type 0) and the REST element (type 1) which holds the trailing whitespace and the line delimiter. Without FULLY, only the type-0 data elements are compared. With FULLY and two TXTRST sources, both elements are included in the comparison and the REST elements are treated as a separate difference class.

If you specified a report file and activate the 'OFFSET' switch, then byte offsets and byte values for each difference are written to the report file.

This can cause a very large report file!

Report format (WINDOW=0)

When WINDOW=0 (the default), the report lists each differing element pair sequentially. Each difference is reported on two lines: one line starting with '<' for the element in source 1, and one line starting with '>' for the element in source 2. The report ends with a summary line giving the total count.

Report format (WINDOW>0)

When WINDOW>0, the report follows the unix diff(1) convention. Groups of consecutive differences are merged into hunks. Each hunk is introduced by a range header of the form:

   NdM     (elements N..N deleted from source 1, not in source 2)
   NaM     (elements M..M added in source 2, not in source 1)
   N,NcM,M (elements N..N in source 1 changed to M..M in source 2)

Element lines from source 1 are prefixed with '<', element lines from source 2 are prefixed with '>'. The report header contains the parameter settings and the report ends with a summary line:

   # Summary: N differences found
   # Total:   N differences found

Report format for TABLE data

When the archive member contains TABLE data, each differing row is reported on a single line showing all column values:

   < ROW(n): COL(c,TYP=t,LEN=l):"data" COL(c,TYP=t,LEN=l):"data"
   > ROW(n): COL(c,TYP=t,LEN=l):"data" COL(c,TYP=t,LEN=l):"data"

Where n is the row number, c is the column index (0-based), t is the element type, l is the data length in bytes, and "data" is the data content rendered as printable ASCII or xNN for non-printable bytes (truncated at 32 characters). With OFFSET, additional hex dump lines follow the ROW line. In the sequential report (WINDOW=0), element- level detail lines are indented with '# ' to show their relation to the enclosing ROW hunk.

To get syntax information, please use:

   flcl SYNTAX ARCHIVE.DIFF

To get help for a parameter, please use:

   flcl HELP ARCHIVE.DIFF.parameter[.parameter[...]]

To read the manual page for a parameter, please use:

   flcl MANPAGE ARCHIVE.DIFF.parameter[.parameter[...]]
      or
   flcl HELP ARCHIVE.DIFF.parameter[.parameter[...]] MAN

To generate the user manual for the command, please use:

   flcl GENDOCU ARCHIVE.DIFF=filename

Parameters can be defined via command line (directly or by parameter file) or via properties taken from the corresponding property file.

Arguments