COMBINE Form 1

Form 1 of COMBINE produces its result by passing each record from leftrecset along with the record in the same ordinal position within rightrecset to the transform to produce a single output record. Grouping (if any) on the leftrecset is preserved. An error occurs if leftrecset and rightrecset contain a different number of records.

Example:

inrec := RECORD
  UNSIGNED6 uid;
END;
outrec := RECORD(inrec)
  STRING20  name;
  STRING11  ssn;
  UNSIGNED8 dob;
END;
ds := DATASET([1,2,3,4,5,6], inrec);
i1 := DATASET([ {1, 'Kevin'  }, 
                {2, 'Richard'}, 
                {5, 'Nigel'  }], 
              {UNSIGNED6 uid, STRING10 name });
i2 := DATASET([ {3, '000-12-3462'}, 
                {5, '000-12-8723'}, 
                {6, '000-10-1002'}], 
              {UNSIGNED6 uid, STRING11 ssn });
i3 := DATASET([ {1, 19700117}, 
                {4, 19831212}, 
                {6, 20010101}], 
              {UNSIGNED6 uid, UNSIGNED8 dob}); 
j1 := JOIN(ds, i1, LEFT.uid = RIGHT.uid, LEFT OUTER, LOOKUP);
j2 := JOIN(ds, i2, LEFT.uid = RIGHT.uid, LEFT OUTER, LOOKUP);
j3 := JOIN(ds, i3, LEFT.uid = RIGHT.uid, LEFT OUTER, LOOKUP);
combined1 := COMBINE(j1, j2, 
                     TRANSFORM(outRec, 
                               SELF := LEFT;
                               SELF := RIGHT;
                               SELF := []),
                     LOCAL);
combined2 := COMBINE(combined1, j3, 
                     TRANSFORM(outRec,
                               SELF.dob := RIGHT.dob;
                               SELF := LEFT),
                     LOCAL);
OUTPUT(combined1);
OUTPUT(combined2);