<p>Sestavení clastru</p>
<p>/* Target table/view(s)  */<br />
%let _OUTPUT = L2_spds.PREDPOJ_RIZ;<br />
%let _OUTPUT1 = L2_spds.PREDPOJ_RIZ;</p>
<p>/* Options  */<br />
%let etls_filter = %nrquote(PREDPOJ_RIZ);<br />
%let etls_maxslots = %nrquote(2);</p>

<div class="post-teaser-block">Toto je náhled článku : <q>Cluster</q>. <a href="https://www.steflovi.cz/?p=56" title="Permanent Link: Cluster" rel="bookmark">Přečtěte si celý příspěvek  (375 words, čas na čtení článku 1:30  mins)</a></div>{"id":56,"date":"2009-10-29T10:21:16","date_gmt":"2009-10-29T08:21:16","guid":{"rendered":"http:\/\/www.mstefl.com\/wordpress\/?p=56"},"modified":"2009-10-29T10:24:44","modified_gmt":"2009-10-29T08:24:44","slug":"cluster","status":"publish","type":"post","link":"https:\/\/www.steflovi.cz\/?p=56","title":{"rendered":"Cluster"},"content":{"rendered":"<p>Sestaven\u00ed clastru<\/p>\n<p>\/* Target table\/view(s)\u00a0 *\/<br \/>\n%let _OUTPUT = L2_spds.PREDPOJ_RIZ;<br \/>\n%let _OUTPUT1 = L2_spds.PREDPOJ_RIZ;<\/p>\n<p>\/* Options\u00a0 *\/<br \/>\n%let etls_filter = %nrquote(PREDPOJ_RIZ);<br \/>\n%let etls_maxslots = %nrquote(2);<\/p>\n<p><!--more--><\/p>\n<p>\/* List of target columns to keep\u00a0 *\/<br \/>\n%let keep = idsml drpr drzuc kodpp riziko castpr plod pldo datspl datvytv storno muc<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ruc upisovaci_rok idflot orgj inkr_pk inks_pk smlo_pk prod_pk idri_pk<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 part_pk orgj_pk odve_pk;<\/p>\n<p>%macro clusterCreateAdd;<br \/>\n\/* Input template on PFD is included to allow inserting in a process flow.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *\/<br \/>\n\/* Use _output macro var to get the name of the library. (Assumes user removed SPDS loader.) *\/<br \/>\n%let etls_libref=%scan(&amp;_output,1,.);<br \/>\n%let etls_outdsn=%scan(&amp;_output,2,.);<\/p>\n<p>proc sql;<br \/>\n\u00a0\u00a0 create table work.SPDSTMP as<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 select memname length = 32<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 from dictionary.tables<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 where upcase(libname) = %upcase(&#8220;&amp;etls_libref&#8221;) and<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 upcase(memname) ^= %upcase(&#8220;&amp;etls_outdsn&#8221;);\u00a0<br \/>\nquit;<\/p>\n<p>data _null_;<br \/>\n\u00a0 \/*\u00a0 If the cluster already exists\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *\/<br \/>\n\u00a0 \/*\u00a0 then generate code for an add.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *\/<br \/>\n\u00a0 \/*\u00a0 Otherwise generate code for a create.*\/\u00a0<br \/>\n\u00a0 if exist(&#8220;&amp;_output&#8221;) then<br \/>\n\u00a0\u00a0\u00a0\u00a0 call symput(&#8216;etls_exist&#8217;,&#8221;YES&#8221;);\u00a0<br \/>\n\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0 call symput(&#8216;etls_exist&#8217;,&#8221;NO&#8221;);<br \/>\nrun;<\/p>\n<p>data _null_;<br \/>\n\u00a0\u00a0 set work.SPDSTMP end=eof;\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0 %if &#8220;&amp;etls_filter&#8221; ne &#8220;&#8221; %then<br \/>\n\u00a0\u00a0 %do;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 where index(upcase(memname),%upcase(&#8220;&amp;etls_filter&#8221;)) &gt; 0;<br \/>\n\u00a0\u00a0 %end;<br \/>\n\u00a0\u00a0<br \/>\n\u00a0\u00a0 if _n_=1 then<br \/>\n\u00a0\u00a0 do;<br \/>\n\u00a0\u00a0\u00a0\u00a0 call execute(&#8220;PROC SPDO library=&amp;etls_libref;&#8221;);<br \/>\n\u00a0\u00a0\u00a0\u00a0 if &#8220;&amp;etls_exist&#8221;=&#8221;YES&#8221; then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8220;cluster add &amp;etls_outdsn &#8220;);<br \/>\n\u00a0\u00a0\u00a0\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8220;cluster create &amp;etls_outdsn &#8220;);\u00a0\u00a0\u00a0<br \/>\n\u00a0\u00a0 end;<br \/>\n\u00a0\u00a0 call execute(&#8221; mem=&#8221;||memname);<br \/>\n\u00a0\u00a0 if eof then do;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 if &#8220;&amp;etls_exist&#8221;=&#8221;YES&#8221; then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8221; ; quit;&#8221;);<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 \/* Only put the maxslots when creating a *\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 \/* new cluster.\u00a0 If max slots from the\u00a0\u00a0 *\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 \/* options tab is 0 then the number of\u00a0\u00a0 *\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 \/* tables in the library will be used.\u00a0\u00a0 *\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 do;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 length etls_max 8;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if &amp;etls_maxslots &gt; 0 then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 etls_max = &amp;etls_maxslots;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 etls_max = _n_;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8221; maxslot=&#8221;||trim(left(put(etls_max,8.)))||&#8221;; quit;&#8221;);\u00a0\u00a0\u00a0\u00a0<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 end;<br \/>\n\u00a0\u00a0 end;<br \/>\nrun;<br \/>\n%mend clusterCreateAdd;<br \/>\n%clusterCreateAdd;<\/p>\n<p>Rozbyt\u00ed clusteru<\/p>\n<p>\/* Source table(s)\/view(s)\u00a0 *\/<br \/>\n%let _INPUT1 = L2_spds.PREDPOJ_RIZ;<br \/>\n%macro clusterUndoTables;<br \/>\n%let etls_libref=%scan(&amp;_INPUT1,1,.);<br \/>\n%let etls_dsn=%scan(&amp;_INPUT1,2,.);<br \/>\n\/* Undo removes the cluster definition.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *\/<br \/>\n\/* The clustered tables are returned to their\u00a0\u00a0 *\/<br \/>\n\/* original unclustered state\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *\/<br \/>\ndata _null_;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8216;Proc spdo library=&amp;etls_libref;&#8217;);<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8216;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cluster undo &amp;etls_dsn;&#8217;);<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 call execute(&#8216;quit;&#8217;);<br \/>\nrun;<br \/>\n%mend clusterUndoTables;<br \/>\n%clusterUndoTables;<\/p>\n\n<div class=\"post-teaser-block\">Toto je n\u00e1hled \u010dl\u00e1nku : <q>Cluster<\/q>. <a href=\"https:\/\/www.steflovi.cz\/?p=56\" title=\"Permanent Link: Cluster\" rel=\"bookmark\">P\u0159e\u010dt\u011bte si cel\u00fd p\u0159\u00edsp\u011bvek  (375 words, \u010das na \u010dten\u00ed \u010dl\u00e1nku 1:30  mins)<\/a><\/div>","protected":false},"excerpt":{"rendered":null,"protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=\/wp\/v2\/posts\/56"}],"collection":[{"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=56"}],"version-history":[{"count":0,"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.steflovi.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}