SWITCH/CASE U00020432 Runtime error ... :CASE must not followed directly by script command :OTHER.
search cancel

SWITCH/CASE U00020432 Runtime error ... :CASE must not followed directly by script command :OTHER.

book

Article ID: 233691

calendar_today

Updated On:

Products

CA Automic One Automation

Issue/Introduction

When using a SWITCH ... CASE statement in Automic scripting, the following example from the documentation or Switch/case statements that build off of this throws an error:

:SWITCH &$PLATFORM#
:CASE "WINDOWS"
! insert these lines in your script to determine if an error occurred
! @set retcode=%errorlevel%
! @if NOT %ERRORLEVEL% == 0 goto :retcode
!

:CASE "UNIX"
:OTHER
:ENDSWITCH

This throws the error:
U00020432 Runtime error in object 'JOB_NAME', line '00008': script command :CASE must not followed directly by script command :OTHER.

Adding a blank line between :CASE "UNIX" and :OTHER resolves this.

Environment

Release : 12.3

Component : AUTOMATION ENGINE

Cause

As designed

Resolution

This behavior is as designed.  There needs to be either a blank line or Automic scripting between the last :CASE statement and the :OTHER statement.  The documentation will be updated to reflect this with the following note:

Note: Use the :OTHER statement once after all :CASE statements. :CASE must not be followed directly by :OTHER

The example will also be updated to the following:

:SWITCH &$PLATFORM#
:CASE "WINDOWS"
! insert these lines in your script to determine if an error occurred
! @set retcode=%errorlevel%
! @if NOT %ERRORLEVEL% == 0 goto :retcode
!

:CASE "UNIX"

:OTHER
:ENDSWITCH

An enhancement must be created if there is a need to have :CASE be on the line directly preceding :OTHER