RECORDOF

RECORDOF( recordset , [LOOKUP])

recordsetThe set of data records whose RECORD structure to use. This may be a DATASET or any derived recordset. If the LOOKUP attribute is used, this may be a filename.
LOOKUPOptional. Specifies that the file layout should be looked up at compile time. See File Layout Resolution at Compile Time in the Programmer's Guide for more details.

The RECORDOF declaration specifies use of just the record layout of the recordset in those situations where you need to inherit the structure of the fields but not their default values, such as child DATASET declarations inside RECORD structures.

This function allows you to keep RECORD structures local to the DATASET whose layout they define and still be able to reference the structure (only, without default values) where needed.

Example:

Layout_People_Slim := RECORD
   STD_People.RecID;
   STD_People.ID;
   STD_People.FirstName;
   STD_People.LastName;
   STD_People.MiddleName;
   STD_People.NameSuffix;
   STD_People.FileDate;
   STD_People.BureauCode;
   STD_People.Gender;
   STD_People.BirthDate;
   STD_People.StreetAddress;
   UNSIGNED8 CSZ_ID;
END;
       
STD_Accounts := TABLE(UID_Accounts,Layout_STD_AcctsFile);
      
CombinedRec := RECORD,MAXLENGTH(100000)
  Layout_People_Slim;
  UNSIGNED1 ChildCount;
  DATASET(RECORDOF(STD_Accounts)) ChildAccts;
END;
        //This ChildAccts definition is equivalent to:
        // DATASET(Layout_STD_AcctsFile) ChildAccts;
        //but doesn't require Layout_STD_AcctsFile to be visible (SHARED or
        // EXPORT)

See Also: DATASET, RECORD Structure