Assigning arrays and strange examples in messages

Posted by Jens Dahlin on 04-Oct-2011 03:57

This simple code:

DEFINE VARIABLE c AS INTEGER   NO-UNDO EXTENT 5 INIT [1,2,3,4,5].
DEFINE VARIABLE d AS INTEGER   NO-UNDO EXTENT 5 .

d = c.

DISPLAY d.


Works in 10.1C but not in 10.2B where it generates error 361: ** Only individual array elements are allowed in expressions or on the right-hand-side of non-array assignments. (361)  .

Checking error 361 in 10.1C and 10.2B does however give basically the same help:

10.1C:

* An array was specified in an expression, on the right-hand side of an assignment, or as a parameter when no array is appropriate or expected.  (361)

If you have arrays Array1 and Array2 for example: it is legal to say:       Array1[3] = Array2[3] and it is legal to say:
     Array1 = Array2

but it is not legal to say Array1[3] = Array2.
Also not allowed:
      myscalar = Array2.
or:   display Array2 += 5.
or:   obj:Meth(Array1) when the target parameter is scalar
S

10.2B:

** Only individual array elements are allowed in expressions or on the right-hand-side of non-array assignments. (361)

If you have array fields ARRAY1 and ARRAY2 for example: it is legal to say:           ARRAY1[3] = ARRAY2[3] and it is legal to say: 

ARRAY1  = ARRAY2

but it is not legal to say ARRAY1[3] = ARRAY2.
   also not allowed:
     myscalar = array2.
or display array2 += 5.
S

Even same strange S in the end...

1) Is array assignment as in this example a removed feature?

2) The example code: display array2 += 5 - what about that one? Is that just a typo or does ABL somehow support increment/decrement operators? Or will it in OE11? Or is it just a bad example?

All Replies

Posted by AdrianJones on 04-Oct-2011 04:30

doesn't work for me in 10.1c. i get the 361 error.

Posted by Jens Dahlin on 04-Oct-2011 04:39

Ooops!

My mistake. I'm confusing different environments. Checking this more carefully I can see that it is the other way around - it does work in 10.2B but not in 10.1C. That makes a whole lot more sense!

Still strange examples under Help -> Messages though!

Posted by AdrianJones on 04-Oct-2011 04:45

no problem! help is indeed confusing - it indicates it should work but it doesn't.

This thread is closed