Sanjeebkumar Sarangi wrote:
Hi,
 What does a negative index mean in an array .If LIST<-1>=ID is a segment
of the code what does this -ve  number mean is it by default the first
element.

LIST<-1> = "X" assigns "X" to the next element in the dynamic array. Used most commonly when adding to an array without calculating the index. It's fast and easy. The trap to watch out for, depending upon version, is when you're building related/associated multi-value fields.

Quick example - say you're describing multiple cars held by a single owner, and you decide to store make, model, year & color for each in associated fields.

So, you start with:
CHEVY, MALIBU, 1991, {NULL}
FORD, F150, 1992, BLUE
CHEVY, SUBURBAN, 1993, RED

You initialize the arrays like this:
MV.MAKE = ""
MV.MODEL = ""
MV.YEAR = ""
MV.COLOR = ""

Then you loop through your data fields, using the <-1> notation to build the multi-value fields.

MV.MAKE<-1> = SPECIFIC.MAKE
MV.MODEL<-1> = SPECIFIC.MODEL
MV.YEAR<-1> = SPECIFIC.YEAR
MV.COLOR<-1> = SPECIFIC.COLOR

BUT - BUT - BUT
Since the FIRST value of the COLOR was null, you'll end up with:
CHEVY; FORD; CHEVY
MALIBU; F150; SUBURBAN
1991; 1992; 1993
BLUE;RED

Since the first instance was null, when you assigned it to the MV.COLOR, MV.COLOR remained null, and thus the second value assigned to it was stored in the first location - which corrupts your data.



> If we do a external conversion usng OCONV(sysdate,'D2/'),the D indicates
> the date conversion specification but why is the 2/ being used here...what
> can be the change in the conversion?

"D2/" is date conversion in mm/dd/yy format, (in US). Probably the most common date conversion I've seen. Another very common one is "D4/" which would provide you with a 4 digit year.

--
Allen Egerton
aegerton at pobox dot com
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to