copydefcal

This utility has been deprecated. It is no longer enhanced and support will be discontinued in version 9.0.22. For more information, see emdef Utility Suite Deprecation.

The copydefcal utility creates a new calendar definition in the Control-M/EM database identical to an existing calendar definition.

Calendars can be copied and saved under different names in the same data center. Calendars in one data center can be copied to a different data center and saved under the same or different names.

Multiple calendars can be selected and copied using the * wildcard character. For an explanation of how wildcards function in XML-based utilities, see Wildcards.

When copydefcal is invoked, a file of arguments that you created is processed. This arguments file contains statements that specify an existing calendar or group of calendars. The specified calendars are exported to an output file. copydefcal reads arguments directly from a plain text arguments file (in XML format) instead of reading them from the command line. For more information, see copydefcal Arguments File Rules.

The copydefcal utility validates the XML rule file according to the validation process in Control-M/EM version 9.0.19 and above.

By default, the utility validates the XML file in accordance with the EmdefValidationVersion system parameter in the CCM ). You can change the value in the CCM without the need to add the switch to the command, which may be preferable if you have many scripts that use a particular validation version.

For an example of the two validation processes see emdef Validation Service Error Message Example.

Copying an Existing Calendar Using the copydefcal Utility

This procedure describes how to create a new calendar definition in the Control-M/EM database identical to an existing calendar definition using the copydefcal utility.

Begin

  1. Do one of the following:

    • UNIX: Log in to a Control-M/EM account.

    • Windows: Open a command prompt window where Control-M/EM is installed. You do not need to be in the Control-M/EM database directory.

      For Windows client installations, open a command prompt window and navigate to the <EM Instance Name>\bin directory.

  2. Enter either of the following commands:

    • emdef copydefcal [-USERNAME <user> [-PASSWORD <password>] | -PASSWORD_FILE <password file>] -HOST <GUI Server Name> -ARG_FILE <args file name> [-vv 2]

    • emdef copydefcal [-u <user> [-p <password>] | -pf <password file>] -s <GUI Server Name> -arg <args file name> [-vv 2]

    For Windows you do not need to use emdef prefix.

For more details on the copydefcal parameters and options, see emdef General Parameters and emdef Switches.

The copydefcal arguments file is checked and processed. If there are any errors in the file, a message is displayed specifying the lines with the errors.

copydefcal Arguments File Rules

Arguments are used as selection criteria to determine which calendars are exported. Arguments are written to the copydefcal argument file. The arguments files created for use with the copydefcal utility are written in XML format and saved in a text file. Instructions for preparing this file are in XML File Rules.

When this file is invoked, calendar definitions are exported from the Control-M/EM database.

The following rules apply to the copydefcal arguments file:

  • More than one calendar can be specified in an arguments file.

  • The arguments file is case-sensitive.

  • Only one COPYCAL parameter can be used in an arguments file.

  • All parameter values (such as strings or digits) must be enclosed in quotation marks

    JOBNAME="Job1"

Using FROM and TO in the copydefcal input file:

  • If you choose to specify a parameter, the FROM subparameter is mandatory, and the TO subparameter is optional.

  • When a FROM value is specified without a TO value, it is used as a filter criterion.

  • When a TO value is included, it indicates the new value with which the parameter is updated.

  • Multiple values can be specified for TO and FROM by using the * wildcard character. For an explanation of how wildcards function in the XML-based utilities, see Wildcards.

  • If any FROM value contains *, and the corresponding TO value contains *, the * in the TO value expresses the same information as the * in the FROM value.

  • The TO attribute of the DATACENTER parameter must be used to import the copied calendar into a different data center if the copy has the same name as the original calendar (the TO attribute is not used with the CALENDAR parameter). Otherwise, the calendar copy overwrites the original in the same data center.

copydefcal Arguments File Parameters

The following table lists the copydefcal utility arguments file parameters:

Parameter

Description

The first two lines of the XML request file for this API request contain information that specifies the version of XML, the text encoding format being used, and the location of the .dtd file.

COPYCAL

Indicates the start and end of the COPYCAL argument. Only criteria that are located between the tags are considered to be part of the argument.

DATACENTER

Defines the Control‑M installation that the calendar definition belongs to.

The COPYCAL element must contain only one DATACENTER parameter.

DATACENTER FROM="EM5NYC" TO="EM7NYC"

FROM: Data center where the source calendar is located.

TO: Data center where a calendar can be created.

CALENDAR

Defines the name of the calendar.

The COPYCAL element must contain only one CALENDAR parameter.

CALENDAR FROM="Cal1" TO="Cal1_COPY"

FROM: Defines the name of the calendar that is copied.

TO: Defines the name of the calendar copy. The copy retains the name of the original calendar if this attribute is not used.

Create and Import a Calendar XML File Example

In the copydefcal XML file, create a copy of the calendar named CAL_3 in the EM10LAdata center.

Copy
<COPYCAL>
<DATACENTER FROM="EM5NYC" TO="EM10LA"/>
<CALENDAR FROM="CAL_3"/>
</COPYCAL>

Copy Multiple Calendars from the Same Data Center XML File Example

In the copydefcal XML file, all calendars in the EM5NYC data center with names beginning with the letter A are copied to the EM7NYC data center. The new calendar names are calendarname_COPY (for example, the copy of the Alljobs calendar is named Alljobs_COPY).

Copy
<COPYCAL>
<DATACENTER FROM="EM5NYC" TO="EM7NYC"/>
<CALENDAR FROM="A*" TO="A*_COPY"/>
</COPYCAL>

Copy a Calendar and Rename the Copy XML File Example

In the copydefcal XML file, the calendar named CAL_NOV in the EM5NYC data center is copied. The name of the copy is CAL_NOV_REVISED.

Copy
<COPYCAL>
<DATACENTER FROM="EM5NYC"/>
<CALENDAR FROM="CAL_NOV" TO="CAL_NOV_REVISED"/>
</COPYCAL>