Page 1 of 1

$UserStatus and Dynamic Arrays

Posted: Fri Aug 25, 2006 12:06 am
by adamski
Hi

Does anyone know if a job's $UserStatus has limitations with respect to storing dynamic arrays?

I note this post (at the bottom) says you can:

viewtopic.php?t=88837

My array structure is:
<1,n>
<2,n>

When I write the $UserStatus to the log, it apears the <2,n>'s are not making it.

If I change the structure to:

<n,1>
<n,2>

I get an abort with the error:

Job control process (pid DSLink2
1) has failed


Where DSLink2 and 1 are values in <n,1> and <n,2> respectively.

Thanks

Posted: Fri Aug 25, 2006 2:00 am
by ray.wurlod
None whatsoever. You can store anything into a job's user status area, including a dynamic array of arbitrary structure.

Whether the activity $UserStatus accurately retrieves this, or truncates it to field #1 only, is something I've never tested. It ought not to - so if you can reproduce it and need the multi-field returned, submit an enhancement request.

A workaround would be to apply a Lower() function to the argument of DSSetUserStatus(), so that every delimiter in the dynamic array is demoted. You can then retrieve the single-field dynamic array and promote them again using a Raise() function before proceeding as planned.

Posted: Sun Aug 27, 2006 4:51 pm
by adamski
Thanks Ray

I will see if I can re-produce this under another scenario, and try the work around if necessary.

Posted: Tue Aug 29, 2006 4:13 pm
by adamski
It seems it is not possible to set $UserStatus as a dynamic array:

Code: Select all

*Set up array      
      TestA<1,1> = '1='
      TestA<1,2>= 'One'
      TestA<2,1>= '2='
      TestA<2,2>= 'Two'
      TestA<3,1>= '3='
      TestA<3,2>= 'Three'

*Set job user status and log
      Call DSSetUserStatus(TestA)
      TestB = DSGetJobInfo(DSJ.ME,DSJ.USERSTATUS)
      Call DSLogInfo(TestB , "This is $UserStatus")
The result of above:
SetUserStatusAsDynamicArray..JobControl (This is $UserStatus): 1=
One

By using Lower and Raise I can achieve the desired outcome:

Code: Select all

*Set up array      
      TestA<1,1> = '1='
      TestA<1,2>= 'One'
      TestA<2,1>= '2='
      TestA<2,2>= 'Two'
      TestA<3,1>= '3='
      TestA<3,2>= 'Three'

*Demote array elements
      TestA = Lower(TestA)

*Set job user status
      Call DSSetUserStatus(TestA)


*Promote back to dynamic array and log
      TestB = Raise(DSGetJobInfo(DSJ.ME,DSJ.USERSTATUS))
      Call DSLogInfo(TestB , "This is $UserStatus")
Result of the above:
SetUserStatusAsDynamicArray..JobControl (This is $UserStatus): 1=
One
2=
Two
3=
Three

Anyone understand what is going on here?

Posted: Tue Aug 29, 2006 7:05 pm
by kduke
What is your problem? All the values printed. If you print a dynamic by sending it to the log then it prints one value per line. It looks just like this.

Posted: Tue Aug 29, 2006 9:14 pm
by adamski
There is really no problem since the implementation of Lower and Raise.

However I am frustrated that a dynamic array could not be stored within $UserStatus without further manipulation.