Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 - Asset Console Creating an Access Definition File Guide


[SWITCH] (conditionally execute a group of statements)

[SWITCH] executes processing when a condition value matches a specified constant.

The [SWITCH] tag is more convenient to use than the [IF] tag when you wish to compare a condition to a large number of constants, because the statements are nested less deeply. When the condition value matches a constant, the processing following the associated [CASE] tag is executed. When the condition value does not match any of the specified constants, the processing following [DEFAULT] is executed; if [DEFAULT] is not defined, no processing is executed.

If the same constant is specified under more than one [CASE] tag, processing is executed beginning with the [CASE] tag in which the constant was first specified (beginning from the left if all of the relevant coding is specified on one line), and continues until all processing specified for the condition value matching those constants has executed.

Organization of this page

Syntax

[SWITCH]
  condition-value
  [CASE]
    constant
      processing-if-condition-value-matches-the-constant
([CASE])
    constant[,constant[,constant...]]
      processing-if-condition-value-matches-any-of-the-constants
([DEFAULT])
    processing-if-no-constant-is-matched
[SWITCH_END]

Values

Example

The example below executes the following processing: