Script: defining arrays does not work as expected : U00020686 Runtime error in object ....
search cancel

Script: defining arrays does not work as expected : U00020686 Runtime error in object ....

book

Article ID: 278574

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

The execution of the following Script section returns systematically an error:

==================================================================

:  SET &COUNT# = 8

:    IF &CNT# < 5
:      DEFINE &SPOUNE#, unsigned, 5
:      P 5
:    ENDIF
:    IF &COUNT# < 10
:      DEFINE &SPOUNE#, unsigned, 10
:      P 10
:    ENDIF

==================================================================

The following message shows up

===================================

U00020686 Runtime error in object 'SCRI.SPOUNE', line '00009'. Array '&SPOUNE#[]' with length '00005' already exists.

===================================

That is by far the strangest, because the logic branching in the script does not allow interpreting line 9 and because the syntax check did not reveal inconsistency in the code.

Environment

Any AE environment

Cause

This is by design. This mechanism has been inherent in One Automation since ever.

 

Resolution

When a script section is executed a pre-compiler goes thru the entire code to pre allocate requested resources.

The pre-compiler will detect here that the same array was declared more than one time in the same object and it considers this as contradictory and will therefore refuse the execution.

Algorithmic aspects and logic are not taken into account by the pre-compiler.