Hi Eugene,
The CORRELATIVE.REUSE setting of the OPTION command
was added at release 2.9-7 but not documented until 2.9-8 because we wanted to
confirm with the user that requested it that we had it correct (which we
did).
As we will see below, part of the original problem
may turn out to be that QM executes correlatives in a different way from Pick
systems.
The precise behaviour of correlatives is not
very well documented in any of the mv systems. We based our implementation on
information extracted from documentation for PI/open, UniVerse, D3, mvBase and
several training packages from Malcolm Bull.
There is frequent reference in these documents to
the use of the R qualifier after a data item to imply an operation equivalent to
use of the REUSE() function in QMBasic. Using the horrors of an F-correlative as
my example, I might have something like
F;'~';1;:
to prefix the content of field 1 with a
tilde. This is equivalent to use of a QMBasic expression
CATS('~',
@RECORD<1>)
But, what if field 1 is multivalued? According to
many of the mv correlative documents, I must amend my correlative to
be
F;'~'R;1;:
which is equivalent to
CATS(REUSE('~'),
@RECORD<1>)
So far, all is ok. Now let's say that I want my
correlative to return the record id (which is always single valued) followed by
a tilde and then the content of multivalued field 1. It looks as though I need
to write
F;0;'~';1
but I somehow need to insert an R option that
will be applied to the result of the first concatenation. The language
doesn't have a way to do this.
I suspect that the underlying problem is that
QM converts correlatives to the equivalent multivalued functions of
QMBasic. From talking with the user who raised this issue, it seems that Pick
systems execute the correlative multiple times, once for each value in the
multivalued data whereas QM executes the composite expression just once,
handling the multivalues internally. In most cases, there is no difference
between these two approaches.
Pondering on this leads to a question... What does
the R option actually do in Pick? If the expression is evaluated many times, it
doesn't appear to be needed. Nothing in any of the documentation we have here
explains what actually happens.
The solution that we came up with that appears to
work in all cases is to add the CORRELATIVE.REUSE option which causes all
correlative operators to behave as though the R option was present, even those
like my double concatenation where there is nowhere in the expression syntax to
insert the R. It was suggested that we should make this behaviour standard but,
just in case there is some case where it would have undesireable effects, we
made it an option.
QM has never guaranteed 100% compatibility with
Pick or any other system but we aim to make migration easy. We have many users
who have migrated from Pick style systems over the last few years and this is
the first time this incompatibility has come up. We discussed various solutions
with the user and decided that the new OPTION setting was the best. Only time
will tell. I suggest that you only enable this setting if you have correlatives
that are not working because of the problem described above. Then there is no
risk of anything else going wrong.
Martin
Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone,
Northampton, NN4 6DB
+44-(0)1604-709200