Array Copy

Is there anyway to do a mem-copy (C++) in progress?
My question is comming from the fact that in our old Database, we have an array of like EXTENT 20.
Is there anyway (apart the DO i = 1 to 20) to copy this array, into a Variable define Like it?

Example:
Define var cVar1 as char extent 20 no-lock.
Define var cVar2 like cVar1 no-lock.
Define i as int no-lock.

/* Replace the following lines */
Do i = 1 to 20:
assign var1 = var2.
end.

/* In C++ i would have done Mem-copy(var1,var2). */

Thanks guys!

MauditOstie
 

breakdown

New Member
Unfortunately, that is the only way to copy variable arrays in Progress. The only thing that might make it a little easier is the "extent" function. Use this if you don't know how many extents are in a variable.

ex:
Define var cVar1 as char extent 20 no-undo.
Define var cVar2 like cVar1 no-undo.
Define var i as int no-undo.

assign cVar1[1] = "ONE"
cVar1[2] = "TWO"
cVar1[3] = "THREE".

do i = 1 to extent(cVar1):

assign cVar2 = cVar1.

end.

disp cVar1[1 for 3]
skip
cVar2[1 for 3].
 
Reply Array Copy

Too bad... Thanks for the tip anyway!
hope Progress will do something about that in the next versions!

Enjoy!
 
Top