Expr-RecordSetOps.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <sect1 id="Record_SetRecord_Set_Operators">
  5. <title>Record Set<indexterm>
  6. <primary>Record Set</primary>
  7. </indexterm> Operators<indexterm>
  8. <primary>Record Set Operators</primary>
  9. </indexterm></title>
  10. <para>The following record set operators are supported (all require that the
  11. files were created using identical RECORD structures<indexterm>
  12. <primary>RECORD structure</primary>
  13. </indexterm>):</para>
  14. <informaltable colsep="1" frame="all" rowsep="1">
  15. <tgroup align="left" cols="2">
  16. <colspec colwidth="94.80pt" />
  17. <colspec />
  18. <tbody>
  19. <row>
  20. <entry>+</entry>
  21. <entry>Append all records from both files, independent of any
  22. order</entry>
  23. </row>
  24. <row>
  25. <entry>&amp;</entry>
  26. <entry>Append all records from both files, maintaining record order
  27. on each node</entry>
  28. </row>
  29. <row>
  30. <entry>-</entry>
  31. <entry>Subtract records from a file</entry>
  32. </row>
  33. </tbody>
  34. </tgroup>
  35. </informaltable>
  36. <para>Example:</para>
  37. <programlisting>MyLayout := RECORD
  38. UNSIGNED Num;
  39. STRING Number;
  40. END;
  41. FirstRecSet := DATASET([{1, 'ONE'}, {2, 'Two'}, {3, 'Three'}, {4, 'Four'}], MyLayout);
  42. SecondRecSet := DATASET([{5, 'FIVE'}, {6, 'SIX'}, {7, 'SEVEN'}, {8, 'EIGHT'}], MyLayout);
  43. ExcludeThese := SecondRecSet(Num &gt; 6);
  44. WholeRecSet := FirstRecSet + SecondRecSet;
  45. ResultSet := WholeRecSet-ExcludeThese;
  46. OUTPUT (WholeRecSet);
  47. OUTPUT(ResultSet);
  48. </programlisting>
  49. <sect2 id="Prefix_Append_Operator">
  50. <title>Prefix Append Operator</title>
  51. <para><emphasis role="bold">(+)
  52. (</emphasis><emphasis>ds_list</emphasis><emphasis role="bold">)
  53. [</emphasis><emphasis>, options</emphasis><emphasis role="bold">]
  54. )</emphasis></para>
  55. <informaltable colsep="1" frame="all" rowsep="1">
  56. <tgroup cols="2">
  57. <colspec colwidth="92.05pt" />
  58. <colspec />
  59. <tbody>
  60. <row>
  61. <entry><emphasis role="bold">(+)</emphasis></entry>
  62. <entry>The prefix append operator.</entry>
  63. </row>
  64. <row>
  65. <entry><emphasis>ds_list</emphasis></entry>
  66. <entry>A comma-delimited list of record sets to append (two or
  67. more). All the record sets must have identical RECORD
  68. structures.</entry>
  69. </row>
  70. <row>
  71. <entry><emphasis>options</emphasis></entry>
  72. <entry>Optional. A comma-delimited list of options from the list
  73. below.</entry>
  74. </row>
  75. </tbody>
  76. </tgroup>
  77. </informaltable>
  78. <para>The prefix append operator <emphasis>(+)</emphasis> provides more
  79. flexibility than the simple infix operators described above. It allows
  80. hints and other options to be associated with the operator. Similar syntax
  81. will be added in a future change for other infix operators.</para>
  82. <para>The following <emphasis>options</emphasis> may be used:</para>
  83. <para><emphasis role="bold">[, UNORDERED | ORDERED(</emphasis>
  84. <emphasis>bool </emphasis><emphasis role="bold">) ] [, STABLE | UNSTABLE ]
  85. [, PARALLEL [ (</emphasis> <emphasis>numthreads </emphasis><emphasis
  86. role="bold">) ] ] [, ALGORITHM(</emphasis> <emphasis>name
  87. </emphasis><emphasis role="bold">) ]</emphasis></para>
  88. <informaltable colsep="1" frame="all" rowsep="1">
  89. <tgroup cols="2">
  90. <colspec colwidth="92.05pt" />
  91. <colspec />
  92. <tbody>
  93. <row>
  94. <entry><emphasis role="bold">UNORDERED</emphasis></entry>
  95. <entry>Optional. Specifies the output record order is not
  96. significant.</entry>
  97. </row>
  98. <row>
  99. <entry><emphasis role="bold">ORDERED</emphasis></entry>
  100. <entry>Specifies the significance of the output record
  101. order.</entry>
  102. </row>
  103. <row>
  104. <entry><emphasis>bool</emphasis></entry>
  105. <entry>When False, specifies the output record order is not
  106. significant. When True, specifies the default output record
  107. order.</entry>
  108. </row>
  109. <row>
  110. <entry><emphasis role="bold">STABLE</emphasis></entry>
  111. <entry>Optional. Specifies the input record order is
  112. significant.</entry>
  113. </row>
  114. <row>
  115. <entry><emphasis role="bold">UNSTABLE</emphasis></entry>
  116. <entry>Optional. Specifies the input record order is not
  117. significant.</entry>
  118. </row>
  119. <row>
  120. <entry><emphasis role="bold">PARALLEL</emphasis></entry>
  121. <entry>Optional. Try to evaluate this activity in
  122. parallel.</entry>
  123. </row>
  124. <row>
  125. <entry><emphasis>numthreads</emphasis></entry>
  126. <entry>Optional. Try to evaluate this activity using
  127. <emphasis>numthreads</emphasis> threads.</entry>
  128. </row>
  129. <row>
  130. <entry><emphasis role="bold">ALGORITHM</emphasis></entry>
  131. <entry>Optional. Override the algorithm used for this
  132. activity.</entry>
  133. </row>
  134. <row>
  135. <entry><emphasis>name</emphasis></entry>
  136. <entry>The algorithm to use for this activity. Must be from the
  137. list of supported algorithms for the SORT function's STABLE and
  138. UNSTABLE options.</entry>
  139. </row>
  140. </tbody>
  141. </tgroup>
  142. </informaltable>
  143. <para>Example:</para>
  144. <programlisting>ds_1 := (+)(ds1, ds2, UNORDERED);
  145. //equivalent to: ds := ds1 + ds2;
  146. ds_2 := (+)(ds1, ds2);
  147. //equivalent to: ds := ds1 &amp; ds2;
  148. ds_3 := (+)(ds1, ds2, ds3);
  149. //multiple file appends are supported</programlisting>
  150. </sect2>
  151. </sect1>