I miss understood you. No, UV doesn't provide the facility to do that
within an array of any type- dynamic or dimensioned- that is not its
purpose. It will work if the arrays are different, such as:
DIM A(10),B(10)
MAT A = ''
MAT B = ''
A(1) = 678
B(1) = 234
CRT 'BEFORE:'
CRT 'A(1) = ':A(1), 'B(1) = ':B(1)
SWAP A(1),B(1)
CRT 'AFTER:'
CRT 'A(1) = ':A(1), 'B(1) = ':B(1)
C = ''
D = ''
C<1> = 1234
C<2> = 334
D<1> = 5678
D<2> = 778
CRT 'BEFORE:'
CRT 'C<1> = ':C<1>, 'C<2> = ':C<2>
CRT 'D<1> = ':D<1>, 'D<2> = ':D<2>
SWAP D, C
CRT 'AFTER:'
CRT 'C<1> = ':C<1>, 'C<2> = ':C<2>
CRT 'D<1> = ':D<1>, 'D<2> = ':D<2>
BEFORE:
A(1) = 678 B(1) = 234
AFTER:
A(1) = 234 B(1) = 678
BEFORE:
C<1> = 1234 C<2> = 334
D<1> = 5678 D<2> = 778
AFTER:
C<1> = 5678 C<2> = 778
D<1> = 1234 D<2> = 334
Since a variable can be considered a dynamic array with a only a single
attribute (our docs show a variable and not a dynamic array), I used a
dynamic array to illustrate the entire array gets swapped with another
array.
Regards,
LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254 Fax: 303-294-4832
Mobile: 720-341-4317
External email: [EMAIL PROTECTED]
WWW: http://www.ibm.com/software/data/u2/support
www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
George Gallen <[EMAIL PROTECTED]>
Sorry Leroy,
but swap only swaps non array values,
and the mat portion will swap one array with another array
I want to swap two values inside an array.
I tried swap a(1),a(2) but it did nothing
tried.
dim a(10)
a(1)=5
a(2)=6
print a(1),a(2)
swap a(1),a(2)
print a(1),a(2)
and got:
5 6
5 6
but it did compile.
I tried swap mat a(1),mat a(2), that did not compile.
>-----Original Message-----
>From: Leroy Dreyfuss [mailto:[EMAIL PROTECTED]
>Sent: Friday, February 13, 2004 5:18 PM
>To: [EMAIL PROTECTED]
>Subject: RE: Swap array values? In UV
>
>
>
>
>
>
>UniVerse 10.0.x and higher have the SWAP command in BASIC.
>Please refer to
>our documentation regarding its use.
>
><-- original message -->
>
>Is there a command to swap two array contents?
>
>Like "matswap" array(x,y) will swap the contents of
>array(x) -> array(y)
>and array(y) -> array(x)
>
>Without using a temp varible. Yes I know I can do it
>that way.
>
>Thanks
>George
>
>George Gallen
>Senior Programmer/Analyst
>Accounting/Data Division
>[EMAIL PROTECTED]
>ph:856.848.1000 Ext 220
>
>SLACK Incorporated - An innovative information, education and
>management
>company
>http://www.slackinc.com
>
>--
>u2-users mailing list
>[EMAIL PROTECTED]
>http://www.oliver.com/mailman/listinfo/u2-users
>
>
>Regards,
>
>LeRoy F. Dreyfuss
>Advanced Technical Services - UniVerse
>IBM U2 Data Management Solutions
>Tel: 303-672-1254 Fax: 303-294-4832
>Mobile: 720-341-4317
>External email: [EMAIL PROTECTED]
>WWW: http://www.ibm.com/software/data/u2/support
>
>www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
>Online!
>--
>u2-users mailing list
>[EMAIL PROTECTED]
>http://www.oliver.com/mailman/listinfo/u2-users
>
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users
Regards,
LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254 Fax: 303-294-4832
Mobile: 720-341-4317
External email: [EMAIL PROTECTED]
WWW: http://www.ibm.com/software/data/u2/support
www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users