Payload INDEX

This form defines an index file containing extra payload fields in addition to the keys. The payload may contain fields with the {BLOB} modifier to allow more than 32K of data per index entry. These BLOB fields are stored within the indexfile, but not with the rest of the record; accessing the BLOB data requires an additional seek.

This form is used primarily by "half-key" JOIN operations to eliminate the need to directly access the baserecset, thus increasing performance over the "full-keyed" version of the same operation (done with the KEYED option on the JOIN). By default, payload fields are not sorted during the BUILD action to minimize space on the leaf nodes of the key. This sorting behavior can be controlled by using sortIndexPayload in a #OPTION statement.

You can also use the "results in" operator (=>) before payload fields as shown below.


Vehicles := DATASET('vehicles',
          {STRING2 st,STRING20 city,STRING20 lname,
          UNSIGNED8 fpos{VIRTUAL(fileposition)}},FLAT);

VehicleKey1 := INDEX(Vehicles,{st,city},{lname,fpos},'vkey::st.city1');

SearchTerms := RECORD;;
Payload     := RECORD
VehicleKey2 := INDEX(Vehicles,SearchTerms,Payload,'vkey::st.city2');

// Using "results in" operator (=>) for payload fields
VehicleKey3 := INDEX(Vehicles,{st,city  => lname},'vkey::st.city3');