KEYDIFF

[ attrname := ] KEYDIFF( index1, index2, file [, OVERWRITE ] [, EXPIRE( [ days ] ) ] [, UNORDERED | ORDERED( bool ) ] [, STABLE | UNSTABLE ] [, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name ) ] );

attrnameOptional. The action name, which turns the action into an attribute definition, therefore not executed until the attrname is used as an action.
index1An INDEX attribute.
index2An INDEX attribute whose structure is identical to index1.
fileA string constant specifying the logical name of the file to write the differences to.
OVERWRITEOptional. Specifies overwriting the filename if it already exists.
EXPIREOptional. Specifies the file is a temporary file that may be automatically deleted after the specified number of days.
daysOptional. The number of days after which the file may be automatically deleted. If omitted, the default is seven (7).
UNORDEREDOptional. Specifies the output record order is not significant.
ORDEREDSpecifies the significance of the output record order.
boolWhen False, specifies the output record order is not significant. When True, specifies the default output record order.
STABLEOptional. Specifies the input record order is significant.
UNSTABLEOptional. Specifies the input record order is not significant.
PARALLELOptional. Try to evaluate this activity in parallel.
numthreadsOptional. Try to evaluate this activity using numthreads threads.
ALGORITHMOptional. Override the algorithm used for this activity.
nameThe algorithm to use for this activity. Must be from the list of supported algorithms for the SORT function's STABLE and UNSTABLE options.

The KEYDIFF action compares index1 to index2 and writes the differences to the specified file. If index1 to index2 are not exactly the same structure, an error occurs. Once generated, the file may be used by the KEYPATCH action.

Example:

Vehicles := DATASET('vehicles',
     {STRING2 st,
      STRING20 city,
      STRING20 lname,
      UNSIGNED8 filepos{VIRTUAL(fileposition)}},
     FLAT);
    
i1 := INDEX(Vehicles,
  {st,city,lname,filepos},
  'vkey::20041201::st.city.lname');
i2 := INDEX(Vehicles,
  {st,city,lname,filepos},
  'vkey::20050101::st.city.lname');
    
KEYDIFF(i1,i2,'KEY::DIFF::20050101::i1i2',OVERWRITE);

See Also: KEYPATCH, INDEX