Parameters

Every KCM Core Service script can require parameters. The caller of the script must provide these parameters. The use of parameters allows scripts to be as generic and flexible as possible.

Scripts can have two types of parameters:

  • Required. The caller must provide these parameters when calling a script.
  • Optional. The caller may provide these parameters when calling a script. If the parameter is omitted in the call, KCM Core assigns it its default value. The default value is set after = in the declaration of the parameter.

A parameter is made optional by stating a value in the declaration (setting a default value), as shown in this example.

Parameter Text first_parameter;
  # This is an required parameter: no default value.

Parameter Text second_parameter = "some text value" 
  # This is an optional parameter. Its default value is present
  # and set to "some text value".

Rules for parameter names are as follows:

  • The parameters must be declared at the beginning of a script, before any instructions.
  • A parameter name consists of any sequence of alphanumeric characters and the underscore (A-Z, a-z, 0-9 and _ ).
  • A parameter name cannot begin with a digit or an underscore.
  • Parameter names are case-sensitive.
  • The following keywords cannot be used as parameter name: NOT, FI, ELSE, ELIF, OD, TRUE, FALSE.

    NOT, FI, ELSE, ELIF, OD, TRUE, FALSE are case-insensitive.

  • The names of variables, parameters, and constants must be unique within their script.

  • A parameter type can be Text, Number, or Boolean.

The parameters have the following syntax.

Parameter Type name;
Parameter Type name = default;

A parameter is always required, unless it has a default value. So the first parameter in the preceding example is a required parameter, and the second one is optional.