BltInFunc-KEYPATCH.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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="KEYPATCH">
  5. <title>KEYPATCH</title>
  6. <para><emphasis>[ </emphasis><emphasis>attrname</emphasis><emphasis
  7. role="bold"> </emphasis><emphasis role="bold">:= ] KEYPATCH<indexterm>
  8. <primary>KEYPATCH</primary>
  9. </indexterm><indexterm>
  10. <primary>KEYPATCH function</primary>
  11. </indexterm>(</emphasis><emphasis> index, patchfile, newfile
  12. </emphasis><emphasis role="bold"> [, OVERWRITE<indexterm>
  13. <primary>OVERWRITE</primary>
  14. </indexterm> ] [</emphasis><emphasis>,</emphasis><emphasis role="bold">
  15. EXPIRE<indexterm>
  16. <primary>EXPIRE</primary>
  17. </indexterm>( [ </emphasis><emphasis>days </emphasis><emphasis
  18. role="bold">] ) ] );</emphasis></para>
  19. <informaltable colsep="1" frame="all" rowsep="1">
  20. <tgroup cols="2">
  21. <colspec colwidth="88.80pt" />
  22. <colspec />
  23. <tbody>
  24. <row>
  25. <entry><emphasis>attrname</emphasis></entry>
  26. <entry>Optional. The action name, which turns the action into an
  27. attribute definition, therefore not executed until the attrname is
  28. used as an action.</entry>
  29. </row>
  30. <row>
  31. <entry><emphasis>index</emphasis></entry>
  32. <entry>The INDEX attribute to apply the changes to.</entry>
  33. </row>
  34. <row>
  35. <entry><emphasis>patchfile</emphasis></entry>
  36. <entry>A string constant specifying the logical name of the file
  37. containing the changes to implement (created by KEYDIFF).</entry>
  38. </row>
  39. <row>
  40. <entry><emphasis>newfile</emphasis></entry>
  41. <entry>A string constant specifying the logical name of the file to
  42. write the new index to.</entry>
  43. </row>
  44. <row>
  45. <entry><emphasis role="bold">OVERWRITE</emphasis></entry>
  46. <entry>Optional. Specifies overwriting the
  47. <emphasis>newfile</emphasis> if it already exists.</entry>
  48. </row>
  49. <row>
  50. <entry><emphasis role="bold">EXPIRE</emphasis></entry>
  51. <entry>Optional. Specifies the <emphasis>newfile</emphasis> is a
  52. temporary file that may be automatically deleted after the specified
  53. number of days.</entry>
  54. </row>
  55. <row>
  56. <entry><emphasis>days</emphasis></entry>
  57. <entry>Optional. The number of days after which the file may be
  58. automatically deleted. If omitted, the default is seven (7).</entry>
  59. </row>
  60. </tbody>
  61. </tgroup>
  62. </informaltable>
  63. <para>The <emphasis role="bold">KEYPATCH </emphasis>action uses the
  64. <emphasis>index</emphasis> and <emphasis>patchfile</emphasis> to write a new
  65. index to the specified <emphasis>newfile</emphasis> containing all the
  66. original index data updated by the information from the
  67. <emphasis>patchfile</emphasis>.</para>
  68. <para>Example:</para>
  69. <programlisting>Vehicles := DATASET('vehicles',
  70. {STRING2 st,
  71. STRING20 city,
  72. STRING20 lname,
  73. UNSIGNED8 filepos{virtual(fileposition)}},
  74. FLAT);
  75. i1 := INDEX(Vehicles,
  76. {st,city,lname,filepos},
  77. 'vkey::20041201::st.city.lname');
  78. i2 := INDEX(Vehicles,
  79. {st,city,lname,filepos},
  80. 'vkey::20050101::st.city.lname');
  81. a := KEYDIFF(i1,i2,'KEY::DIFF::20050101::i1i2',OVERWRITE);
  82. b := KEYPATCH(i1,
  83. 'KEY::DIFF::20050101::i1i2',
  84. 'vkey::st.city.lname'OVERWRITE);
  85. SEQUENTIAL(a,b);
  86. </programlisting>
  87. <para>See Also: <link linkend="KEYDIFF">KEYDIFF</link>, <link
  88. linkend="INDEX_record_structure">INDEX</link></para>
  89. </sect1>