search cancel

Publishing an empty array does not publish the array with defined index amount

book

Article ID: 254372

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation

Issue/Introduction

When running a task within a workflow that publishes or fills an array that was published earlier in the workflow with a high value, the following error occurs:

U00021719 Syntax error in object 'JOB_NAME(2)', line '00000'. 'U01001341 The index '2' is outside of the valid area of the array 'ARR_2_SEND_GLOBAL#'.'.

This can be reproduced in the following way:

  1. Create a workflow with Generate at runtime and the following in the process tab:
    :DEFINE &ARR_2_SEND_GLOBAL#,string,50
    :PUBLISH &ARR_2_SEND_GLOBAL#[],ARR_2_SEND_GLOBAL#,WORKFLOW

  2. Create a job with Generate at runtime and the following in the Process tab:
     :DEFINE &ARR_2_SEND_LOCAL#, string, 50
     :   register_variable "ARR_2_SEND_LOCAL#[1]","one"
     :   register_variable "ARR_2_SEND_LOCAL#[2]","two"
     :   register_variable "ARR_2_SEND_LOCAL#[3]","three"

    Post-Process should include::
    :PUBLISH &ARR_2_SEND_LOCAL#[],ARR_2_SEND_GLOBAL#,WORKFLOW

  3. Create a script with Generate at runtime and the following in Process tab:
    :P "&ARR_2_SEND_GLOBAL#[1] -- &ARR_2_SEND_GLOBAL#[2] -- &ARR_2_SEND_GLOBAL#[3]"

  4. Add the job from step 2 into the workflow as task 1

  5. Add the script from step 3 into the workflow as task 2

  6. Run the workflow

The global array will be shown as defined with 50 indexes, but published empty.  This shows in the workflow report:

U00020237 The object variable '&ARR_2_SEND_GLOBAL#[00001]' in object: 'JOBP.NAME', line: '00011' (RunID: '0001069075') has been created with the value '' by  using the command :PUBLISH.

The first job will then end with FAULT_POST-PROCESSING - error in post processing.  The Details of the job show:

U00021719 Syntax error in object 'JOBS.NAME(2)', line '00000'. 'U01001341 The index '2' is outside of the valid area of the array 'ARR_2_SEND_GLOBAL#'.'.

The publishing of the array from the job does got through.  This can also be shown in the workflow report:

2022-10-08 01:09:04 - U00020237 The object variable '&ARR_2_SEND_GLOBAL#[00001]' in object: 'JOBS.NAME(2)', line: '00004' (RunID: '0001069076') has been created with the value 'one' by  using the command :PUBLISH.
2022-10-08 01:09:04 - U00020237 The object variable '&ARR_2_SEND_GLOBAL#[00002]' in object: 'JOBS.NAME(2)', line: '00004' (RunID: '0001069076') has been created with the value 'two' by  using the command :PUBLISH.
2022-10-08 01:09:04 - U00020237 The object variable '&ARR_2_SEND_GLOBAL#[00003]' in object: 'JOBS.NAME(2)', line: '00004' (RunID: '0001069076') has been created with the value 'three' by  using the command :PUBLISH.

The script will also print out the contents of the array:

2022-10-08 01:09:04 - U00020206 Variable '&ARR_2_SEND_GLOBAL#[00001]' was stored with value 'one'.
2022-10-08 01:09:04 - U00020206 Variable '&ARR_2_SEND_GLOBAL#[00002]' was stored with value 'two'.
2022-10-08 01:09:04 - U00020206 Variable '&ARR_2_SEND_GLOBAL#[00003]' was stored with value 'three'.
2022-10-08 01:09:04 - U00020408 one -- two -- three

Environment

Release : 12.3, 12.3, 21.0

Cause

This is behavior as designed

Resolution

the behavior seen is as designed. 

The first :PUBLISH of the global array in the workflow actually publishes the array as an empty array even though it is defined as having 50 indexes.  This is for performance reasons as defining and publishing too large an array will have an adverse effect on the system.  This is documented here - https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/12.3/Automic%20Automation%20Guides/help.htm#Script/Reference/PUBLISH.htm

  • Arrays are published with their filled size for performance reasons.
    Examples
    An array is empty (all entries have an assigned null string). Nothing is published.
    A different array has 5 entries. The last 2 entries are null strings. Only the first 3 entries are published to subsequent tasks. The size of the array in the subsequent task is limited to 3.

The error later on when the array is re-published from the job to the workflow is more of a warning that the array is being re-sized to something larger than the original.  A way around this is to define and fill the array fully in the workflow.  There are no plans to change this behavior (the message that appears).  Workflows and jobs/scripts can be designed in such a way to ignore this error message if it is seen.