Now that I think about this, "K" is the array being traversed?  We simply
remove the next attribute/value/subvalue in array "K" and assigning this
value to DUM.  For example:

K = I^AM^HAPPY]TO]READ^THIS^LIST

REMOVE DUM FROM K SETTING MORE

would result in:

DUM  = "I"
K    = the above array
MORE = 2

However, (from the documentation), the pointer is reset to the beginning of
dynamic.array whenever dynamic.array is reassigned. Therefore, dynamic.array
should not be assigned a new value until all elements have been extracted
(that is, until variable = 0).  So, the line "K=K" simply reassigns the
array to itself, thus resetting the pointer.

In UniData and D3 the "REMOVE" statement looks like:

REMOVE variable FROM dynamic.array AT position.variable SETTING
delimiter.variable

This allows the explicit setting of the pointer, without resorting to
reinitialization by reassigning the array variable.  I've always just
assigned "Position.Variable" prior to doing any "REMOVE" stuff.  But then,
UniVerse is sometimes a different animal.  :-)

Bill

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, January 19, 2005 1:22 PM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] K = K
>
>
> Date: Wed, 19 Jan 2005 13:29:15 -0600
> Marilyn Hilb <[EMAIL PROTECTED]> wrote:
>
> > I frequently see this type of line K = K in the code
> > I work on and never understood why.
> >
> > -----Original Message-----
> > From: Andrea Charles [mailto:[EMAIL PROTECTED]
> >
> > Do you need the K = K ?
> > --------------------------
> > ... (Code from Charles Stevenson)
> >
> > REMOVE DUM FROM K SETTING MORE ; check for any delimiters
> > K = K ; * reset rmv ptr in case calling pgm cares.
>
> According to the UniData Help for REMOVE, in the code sample above, DUM
> would be set to the first string delimited by a standard delimiter (e.g.,
> @AM, @VM), and MORE would be set to index the level of the delimiter
> encountered: 0=End of array, 1=Record Mark (255), [EMAIL PROTECTED] (254),
> [EMAIL PROTECTED] (253),
> etc.  A pointer is maintained so that the next REMOVE X FROM K
> would return
> the next string.
>
> The comment is stating that the "K = K" is used to reset the
> REMOVE pointer
> to the beginning of the string.
>
> Further info on using REMOVE:
>
> REMOVE is useful for sequentially processing all the elements of a dynamic
> array without having to "recount" for each subsequent item.  However, you
> need to check your delimiters to find attributes/values/subvalues.  A
> similar method to process each attribute is to SELECT K TO KLIST and then
> READNEXT DUM FROM KLIST within a loop.
>
> --Tom Pellitieri
>   Century Equipment
>   Toledo, Ohio
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to