You use the CROSS clause to perform the following tasks: o Compare records from one domain or collection o Combine records from two or more domains or collections o Flatten hierarchical domains to ease access to the list items Format CROSS [context-variable IN] rse-source [OVER field-name] [...]
1 – Arguments
context-variable Is the name of a valid context variable. A context variable is a temporary name that identifies a record stream to DEC DATATRIEVE. rse-source Is the record selection expression (RSE) that identifies the records you want to work with. field-name Is a field whose values form the basis for the cross operation.
2 – Example
The following query uses one RSE that includes five out of the six optional elements of an RSE. DEC DATATRIEVE processes the query far faster than if nested FOR loops were used: DTR> DEFINE PROCEDURE CROS DFN> READY YACHTS DFN> PRINT BUILDER, RIG, A.RIG OF DFN> A IN YACHTS CROSS YACHTS OVER BUILDER WITH DFN> RIG GT A.RIG REDUCED TO BUILDER, RIG, A.RIG DFN> END_PROCEDURE DTR> :CROS MANUFACTURER RIG RIG AMERICAN SLOOP MS CHALLENGER SLOOP KETCH GRAMPIAN SLOOP KETCH IRWIN SLOOP KETCH ISLANDER SLOOP KETCH NORTHERN SLOOP KETCH PEARSON SLOOP KETCH DTR>