Re: [UV] VARIABLE-1 = and Basic Compile $OPTIONSEXTRA.DELIMwork consistently
this is not exactly correct while you are correct that the 3 statements result in 2 attributes, the 2nd state does indeed have aneffect A='abc' ;* A=abc , len(A)=3 A-1='' ;* A=abc:@FM , len(A)=4 A-1='def' ;* A=abc:@FM:def , len(A)=7 when EXTRA.DELIM is used the results are : A='abc' ;* A=abc , len(A)=3 A-1='' ;* A=abc:@FM , len(A)=4 A-1='def' ;* A=abc:@FM:@FM:def , len(A)=8 - Original Message - From: Louis Windsor To: U2 Users Discussion List Sent: Tuesday, February 03, 2004 6:42 AM Subject: Re: [UV] VARIABLE-1 = "" and Basic Compile "$OPTIONSEXTRA.DELIM"work "consistently" Sorry for jumping in without checking my facts first. You are right the sequence A = 'abc' A-1 = '' A-1 = 'def' results in A having TWO attributes NOT three. The second statement has no effect. This is as it works on Windows XP Prof and the Personnel version of UniVerse. If my memory serves me this is also how it works on UV9.6 on Unix (HPUX). Again I think the statement A-1='' is always ineffective. UV without over- riding options etc will never insert a null at the end of a string variable. My experience is mainly with Pick flavour. Louis - Original Message - From: Marco Manyevere To: [EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 5:34 PM 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 unexpectedand 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 REPLACEextract 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 normaland documented. The explanation for this is found in the "REPLACE" Basicfunction, which is the equivalent for the angle brackets notation at theleft 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 functionSyntaxREPLACE (_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 anempty string and an attempt is made to append the new element to the endof the dynamic ar ray, field, or value, the dynamic array, field, or valueis leftunchanged; additional delimiters are not appended. Use the EXTRA.DELIMoption of the $OPTIONS statement to make the REPLACE function appenda delimiter to the dynamic array, field, or value/...The fact is that "UniVerse" is mainly designed to reproduce the behaviourof legacy products in the "Pick" family. In this case, the implementationof the "INFORMATION" and "IDEAL" flavour followed the default behaviour in"Pick" native products.I hope this answered your question.Regards,Hervé BALESTRIERISupport Technique Avancé - IBM Data Management - Produits "U2"- Forwarded by Herve Balestrieri/France/IBM on 03/02/2004 09:35 -Marco Manyevere <[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 = 3A-1 = ''A-1 = 4PRINT A3I expect it output '3' but it outputs '4'. Whats the explanation? I'm on UV9.6 [NT] running information flavour.Regards,MarcoBT 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
Re: [UV] VARIABLE-1 = and Basic Compile$OPTIONSEXTRA.DELIMwork consistently
I think that the amount of diverse replies on this topic indicates an inconsistency across platforms and that the use of a MV counter either derived or managed is clearly the best solution that a programmer can take to any MV environment, new or old. It would remove any suspicion to wonder if it's working or not. I've never been let down by a real counter. If you were managing an array in another form of Basic then you would have to use a counter. my 1 cent. - Original Message - From: gerry simpson To: U2 Users Discussion List Sent: Tuesday, February 03, 2004 7:25 AM Subject: Re: [UV] VARIABLE-1 = "" and Basic Compile"$OPTIONSEXTRA.DELIM"work "consistently" this is not exactly correct while you are correct that the 3 statements result in 2 attributes, the 2nd state does indeed have aneffect A='abc' ;* A=abc , len(A)=3 A-1='' ;* A=abc:@FM , len(A)=4 A-1='def' ;* A=abc:@FM:def , len(A)=7 when EXTRA.DELIM is used the results are : A='abc' ;* A=abc , len(A)=3 A-1='' ;* A=abc:@FM , len(A)=4 A-1='def' ;* A=abc:@FM:@FM:def , len(A)=8 - Original Message - From: Louis Windsor To: U2 Users Discussion List Sent: Tuesday, February 03, 2004 6:42 AM Subject: Re: [UV] VARIABLE-1 = "" and Basic Compile "$OPTIONSEXTRA.DELIM"work "consistently" Sorry for jumping in without checking my facts first. You are right the sequence A = 'abc' A-1 = '' A-1 = 'def' results in A having TWO attributes NOT three. The second statement has no effect. This is as it works on Windows XP Prof and the Personnel version of UniVerse. If my memory serves me this is also how it works on UV9.6 on Unix (HPUX). Again I think the statement A-1='' is always ineffective. UV without over- riding options etc will never insert a null at the end of a string variable. My experience is mainly with Pick flavour. Louis - Original Message - From: Marco Manyevere To: [EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 5:34 PM 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 unexpectedand 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 REPLACEextract 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 normaland documented. The explanation for this is found in the "REPLACE" Basicfunction, which is the equivalent for the angle brackets notation at theleft 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 functionSyntaxREPLACE (_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 anempty string and an attempt is made to append the new element to the endof the dynamic ar ray, field, or value, the dynamic array, field, or valueis leftunchanged; additional delimiters are not appended. Use the EXTRA.DELIMoption of the $OPTIONS statement to make the REPLACE function appenda delimiter to the dynamic array, field, or value/...The fact is that "UniVerse" is mainly designed to reproduce the behaviourof legacy products in the "Pick" family. In this case, the implementationof the "INFORMATION" and "IDEAL" flavour followed the default behaviour in"Pick" native products.I hope this