{"id":13364,"date":"2020-02-11T00:11:49","date_gmt":"2020-02-10T23:11:49","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/"},"modified":"2020-02-11T00:11:49","modified_gmt":"2020-02-10T23:11:49","slug":"control-m-em-emdef-utility-calendars","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/","title":{"rendered":"Control-M\/EM &#8211; emdef utility &#8211; Calendars"},"content":{"rendered":"<p>The emdef is a command line utility used to make various modifications to calendar definitions in the Control-M\/EM database. It can be used to extract data as a backup, or for migration from one to another environment.<br \/>\n<!--more--><\/p>\n<p>The emdef need some parameters which vary according to the method to be executed, methods related calendars are:<\/p>\n<ul>\n<li><b>copydefcal<\/b>: Creates a new calendar definition identical to an existing one<\/li>\n<li><b>exportdefcal<\/b>: Exports calendar definitions to a file for use as input to other utilities<\/li>\n<li><b>defcal<\/b>: Imports calendar definitions from a file<\/li>\n<\/ul>\n<p>At a customer this tool is widely used to automate some daily actions, e.g. export calendars and integrate them in other environment.<\/p>\n<h2>Basic parameters definition<\/h2>\n<p>To run emdef there are some fixed parameters whatever the method used, the syntax should be like:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef &lt;METHOD_TO_USE&gt; &#x5B;-USERNAME &lt;userName&gt; &#x5B;-PASSWORD &lt;password&gt;] | -PASSWORD_FILE &lt;passwordFile&gt;] -HOST &lt;guiServerName&gt; ...<\/pre>\n<ul>\n<li><b>userName<\/b>: The Control-M\/EM user name<\/li>\n<li><b>password<\/b>: The control-M\/EM user password<\/li>\n<li><b>passwordFile<\/b>: Here you have the choice to put the user and password in the command line, or use the passwordFile which is a file containing an unencrypted user name and password on separate lines in the below format:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">user=userName\npassword=password<\/pre>\n<p>\tI personally recommend this practice to avoid adding user\/password in the command line, on the other hand you have to correctly set file permissions!<\/li>\n<li><b>guiServerName<\/b>: Control-M\/EM GUI server host name or IP address<\/li>\n<\/ul>\n<p>Let&#8217;s move to methods to better understand this utility.<\/p>\n<h2>Methods definition<\/h2>\n<h3>copydefcal<\/h3>\n<p>The copydefcal method creates new calendar(s) definition in the Control-M\/EM database identical to existing calendar(s) definition. Calendar(s) can be copied and saved under different names in the same data center, or can be copied to a different data center and saved under the same or different names.<br \/>\nAs you noticed one or multiple calendars can be handled in the same time using the * wildcard character.<\/p>\n<p>To run the copydefcal utility, you need to specify basic parameters shown before plus the below one: <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">-arg &lt;argFileName&gt;<\/pre>\n<p>        =&gt; Path and name of the arguments file containing the copydefcal specifications<\/p>\n<p><strong>Example: Copy all calendars from one datacenter to another<\/strong><\/p>\n<ol>\n<li>Create an argument file copycal.xml like the following:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;COPYCAL&gt;\n  &lt;DATACENTER FROM=&quot;DC_A&quot; TO=&quot;DC_B&quot;\/&gt;\n  &lt;CALENDAR FROM=&quot;*&quot; TO=&quot;*&quot;\/&gt;\n&lt;\/COPYCAL&gt;\n<\/pre>\n<\/li>\n<li>Create password file credentials.txt:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\nuser=emuser\npassword=MyEmUserPass\n<\/pre>\n<\/li>\n<li>Execute the command:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef copydefcal -pf &lt;passwordFile&gt; -s &lt;guiServerName&gt; -arg &lt;argFileName&gt;<\/pre>\n<p>Which correspond to:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef copydefcal -pf credentials.txt -s guiserverhostname -arg copycal.xml<\/pre>\n<\/li>\n<\/ol>\n<h3>exportdefcal<\/h3>\n<p>The exportdefcal utility exports calendar definitions in the Control-M\/EM database to an output file for use as input to other utilities.<br \/>\nIn fact, when the exportdefcal utility is invoked, an arguments file that you prepare is processed. This arguments file contains statements that specify an existing calendar or group of calendars. The calendars that you specified in the arguments file are exported to an output file. You can modify the exported calendars in the output file and re-import them into the Control-M\/EM database using the defcal utility<br \/>\nTo run the exportdefcal utility, you need to specify basic parameters shown before plus the below: <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">-arg &lt;argFileName&gt; -out &lt;outFileName&gt;<\/pre>\n<p>        =&gt; The argument file prepared is processed when the exportdefcal is invoked, this file should contains statements that specify an existing calendar or group of calendars.<br \/>\n        =&gt; Calendar(s) will be exported in the output file you specified as a parameter, this file definitions can be imported into a Control-M\/EM using defcal utiliy for example.<\/p>\n<p><strong>Example: Export all calendars except one, from a datacenter<\/strong><\/p>\n<ol>\n<li>Create an argument file exportcal.xml like the following:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;TERMS&gt;\n\t&lt;TERM&gt;\n\t\t&lt;PARAM NAME=&quot;DATACENTER&quot; OP=&quot;EQ&quot; VALUE=&quot;DC_0&quot;\/&gt;\n\t\t&lt;PARAM NAME=&quot;CALENDAR&quot; OP=&quot;NEQ&quot; VALUE=&quot;ALL_DAYS_CAL&quot;\/&gt;\n\t\t&lt;PARAM NAME=&quot;TYPE&quot; OP=&quot;EQ&quot; VALUE=&quot;Periodic&quot;\/&gt;\n\t&lt;\/TERM&gt;\n&lt;\/TERMS&gt;\n<\/pre>\n<p>Here I export all periodic calendars in the data center DC_0 and not equal to ALL_DAYS_CAL. See below the syntax to be respected.<\/li>\n<li>Use the same credentials.txt created above.<\/li>\n<li>Execute the command:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef exportdeffolder -pf &lt;passwordfile&gt; -s &lt;guiservername&gt; -arg &lt;argfilename&gt; -out &lt;outfilename&gt;<\/pre>\n<p>Which correspond to:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef exportdeffolder -pf credentials.txt -s guiserverhostname -arg exportcal.xml -out DC_0_CAL_Def.xml<\/pre>\n<\/li>\n<\/ol>\n<p>It is important to mention here the syntax to create the argument file:<\/p>\n<ul>\n<li><strong>TERMS<\/strong><br \/>\nThese tags indicate the start and end of the TERMS file. Only criteria that are located between the tags are considered to be part of the argument!<\/li>\n<li><strong>TERM<\/strong><br \/>\nThe TERM tags indicate the start and the end of a group of selection criteria used to specify a calendar or calendars that are to be exported.<\/li>\n<li><strong>Relationship between terms<\/strong><br \/>\nYou can use AND and OR to join two terms.<\/li>\n<li><strong>Parameter name<\/strong><br \/>\nParmeters name are fixed:<br \/>\n\t&#8211; DATACENTER<br \/>\n\t&#8211; CALENDAR<br \/>\n\t&#8211; TYPE<\/li>\n<li><strong>Relationship between the NAME and the VALUE<\/strong><br \/>\nValid values:<br \/>\n\t&#8211; EQ<br \/>\n\t&#8211; NEQ<br \/>\n\t&#8211; NOTIN<br \/>\n\t&#8211; LIKE<\/li>\n<li><strong>Value<\/strong><br \/>\nOf course, it should correspond to the parameter:<br \/>\n\t-For DATACENTER: name of the Control-M installation<br \/>\n\t-For CALENDAR: calendar name<br \/>\n\t-For TYPE: Relative, Regular, Periodic, Rule_Based<\/li>\n<\/ol>\n<h3>defcal<\/h3>\n<p>The defcal utility imports a calendar definition into the Control-M\/EM database, it reads calendar definitions directly from a plain text input file in XML format, maybe generated in the step before? \ud83d\ude42<br \/>\nTo run the exportdefcal utility, you need to specify basic parameters shown before plus the below one: <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">-src &lt;srcFileName&gt;<\/pre>\n<p>        =&gt; The source file is a calendar(s) definition in a xml file<\/p>\n<p><strong>Example: Export all calendars except one, from a datacenter<\/strong><\/p>\n<ol>\n<li>Use the same credentials.txt created above.<\/li>\n<li>Execute the command:\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef defcal -pf &lt;passwordFile&gt; -s &lt;guiServerName&gt; -src &lt;srcFileName&gt;<\/pre>\n<p>Which correspond to:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">emdef defcal -pf credentials.txt -s guiserverhostname -src DC_0_CAL_Def.xml<\/pre>\n<\/li>\n<\/ol>\n<p>As you saw this utility may be so useful to automate your work and standardize your calendars across all environments. My colleague Nabil talked about calendars management in this <a href=\"https:\/\/www.dbi-services.com\/blog\/control-m-import-export-calendar\/\" rel=\"noopener noreferrer\" target=\"_blank\">blog<\/a>. In the next <a href=\"https:\/\/www.dbi-services.com\/blog\/?p=37162\" rel=\"noopener noreferrer\" target=\"_blank\">blog<\/a> I will talk about emdef utility with folders. And you? Did you already use it? Don&#8217;t hesitate to share your experience and ask questions \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The emdef is a command line utility used to make various modifications to calendar definitions in the Control-M\/EM database. It can be used to extract data as a backup, or for migration from one to another environment.<\/p>\n","protected":false},"author":46,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1256],"tags":[717,1812],"type_dbi":[],"class_list":["post-13364","post","type-post","status-publish","format-standard","hentry","category-control-m","tag-control-m","tag-utility"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Control-M\/EM - emdef utility - Calendars - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Control-M\/EM - emdef utility - Calendars\" \/>\n<meta property=\"og:description\" content=\"The emdef is a command line utility used to make various modifications to calendar definitions in the Control-M\/EM database. It can be used to extract data as a backup, or for migration from one to another environment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-10T23:11:49+00:00\" \/>\n<meta name=\"author\" content=\"David Diab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Diab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\"},\"author\":{\"name\":\"David Diab\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\"},\"headline\":\"Control-M\/EM &#8211; emdef utility &#8211; Calendars\",\"datePublished\":\"2020-02-10T23:11:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\"},\"wordCount\":1136,\"commentCount\":0,\"keywords\":[\"Control-M\",\"utility\"],\"articleSection\":[\"Control-M\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\",\"name\":\"Control-M\/EM - emdef utility - Calendars - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2020-02-10T23:11:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Control-M\/EM &#8211; emdef utility &#8211; Calendars\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\",\"name\":\"David Diab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"caption\":\"David Diab\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/david-diab\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Control-M\/EM - emdef utility - Calendars - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/","og_locale":"en_US","og_type":"article","og_title":"Control-M\/EM - emdef utility - Calendars","og_description":"The emdef is a command line utility used to make various modifications to calendar definitions in the Control-M\/EM database. It can be used to extract data as a backup, or for migration from one to another environment.","og_url":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/","og_site_name":"dbi Blog","article_published_time":"2020-02-10T23:11:49+00:00","author":"David Diab","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Diab","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/"},"author":{"name":"David Diab","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86"},"headline":"Control-M\/EM &#8211; emdef utility &#8211; Calendars","datePublished":"2020-02-10T23:11:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/"},"wordCount":1136,"commentCount":0,"keywords":["Control-M","utility"],"articleSection":["Control-M"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/","url":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/","name":"Control-M\/EM - emdef utility - Calendars - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2020-02-10T23:11:49+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/control-m-em-emdef-utility-calendars\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Control-M\/EM &#8211; emdef utility &#8211; Calendars"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86","name":"David Diab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","caption":"David Diab"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/david-diab\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=13364"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13364\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=13364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=13364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=13364"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=13364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}