As I recall, the INSERT function with a -1 parameter always added the
relevant field mark until one of the Microdata releases around 1979, when some
bright soul in their engineering department decided that the extra null value at
the end was 'irrelevant' and should not be added. This change in behavior
provoked a storm of protest at the next national conference, as all of us had
incorporated code that used the -1 in sets of multi-valued attributes that
needed to stay in sync.
PO #
Item (mv'd)
Qty on order (mv'd)
Qty in stock (mv'd)
If there was nothing in stock for the third item on the Purchase Order, but
there was stock for the fourth item on the Purchase Order, we all wanted the
data to look like this
001 P001 @VM P002 @VM P003 @VM P004
002 50 @VM 20 @VM 40 @VM 30
003 10 @VM 20 @VM @VM 15
But instead, suddenly we were seeing 15 units onhand for P003 and no onhand
for P004. The 'irrelevant' data was very relevant in our applications, and
the result of the change in behavior was significant (as in, what a nightmare,
reprogramming every update routine that included that syntax!).
Microdata management understood our frustration and the subsequent
release set the behavior back to always inserting the field mark. However,
most of us who lived through that Microdata release have steered clear of the -1
except for lists which are never going to have to synchronize with any other
list. It is safer not to assume that an engineer who does not understand
how you are using the product is not going to change the behavior out from under
you.
Susan M. Lynch F.W. Davison & Company, Inc. (781) 340-9255
----- Original Message -----
Sent: Tuesday, February 03, 2004 4:34
AM
Subject: Re: [UV] VARIABLE<-1> = ""
and Basic Compile "$OPTIONS EXTRA.DELIM"work "consistently"
The same documentation goes on to say:
In INFORMATION and IN2 flavor accounts, if _expression_ is an empty string
and the new element is appended to the end of the dynamic array,
the end of
a field, or the end of a value, a delimiter is appended to the
dynamic array,
field, or value. Use the -EXTRA.DELIM option of the
$OPTIONS
statement
to make the REPLACE function work as it does in IDEAL, PICK,
and
REALITY flavor accounts.
In my opinion this behaviour is still unexpected and here
is why I say so:
If Information behaves the same as PICK as you say, then the
behaviour is still contrary to documentation because in the example I gave
below, a @FM was still appended even if the string to be added was empty:
i.e.
A = 'abc'
A<-1> = ''
A<-1> = 'def'
will result in 3 fields. According to the REPLACE extract
you quoted, A<-1> = '' should not add a field mark regardless of
whether A is empty or not for PICK flavour.
Marco
Marco,
As
some previous replies were saying, the behaviour you describe is
normal and documented. The explanation for this is found in the "REPLACE"
Basic function, which is the equivalent for the angle brackets notation
at the left of an assignment operator ("=") for dynamic arrays
handling. For more information, please refer to the Basic documentation
manual (File "BASIC.pdf" in the CDROM library)
Here is an excerpt
of the documentation : ---- REPLACE function
Syntax REPLACE
(_expression_, field#, value#, subvalue# { , | ; } replacement) REPLACE
(_expression_ [ ,field# [ ,value#] ] ; replacement) variable < field# [
,value# [ ,subvalue#] ] > .../... In IDEAL, PICK, PIOPEN, and
REALITY flavor accounts, if replacement is an empty string and an attempt
is made to append the new element to the end of the dynamic ar ray,
field, or value, the dynamic array, field, or value is left unchanged;
additional delimiters are not appended. Use the EXTRA.DELIM option of the
$OPTIONS statement to make the REPLACE function append a delimiter to the
dynamic array, field, or value. .../... ----
The fact is that
"UniVerse" is mainly designed to reproduce the behaviour of legacy
products in the "Pick" family. In this case, the implementation of the
"INFORMATION" and "IDEAL" flavour followed the default behaviour
in "Pick" native products.
I hope this answered your
question.
Regards,
Hervé BALESTRIERI
Support Technique
Avancé - IBM Data Management - Produits "U2"
----- Forwarded by Herve
Balestrieri/France/IBM on 03/02/2004 09:35 -----
Marco Manyevere
<[EMAIL PROTECTED] To: [EMAIL PROTECTED] .com> cc: Sent by:
Subject: VARIABLE<-1> = '' Inconsistent behaviour
u2-users-bounces@ oliver.com
03/02 /2004 05:55
Please respond to U2 Users Discussion List
Hi All,
Consider the program:
A =
'' A<-1> = '' A<-1> = '' A<-1> = 3 A<-1>
= '' A<-1> = 4 PRINT A<3>
I expect it output '3'
but it outputs '4'. Whats the explanation? I'm on UV 9.6 [NT] running
information flavour.
Regards, Marco
BT Yahoo!
Broadband - Free modem offer, sign up online today and save
£80 _______________________________________________ u2-users mailing
list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
Yahoo!
Messenger - Communicate instantly..."Ping" your friends today! Download
Messenger Now
_______________________________________________ u2-users mailing
list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
|