FUNCTION INVERT(DA)
LastUpdated... = "Rev: 19:40 21Jul1997 andrewm1 24 /home/andrew/BP/INVERT"
* Function to do a matrix inversion of a dynamic array.
* Copyright (C) 1996, Andrew McLaughlin. All rights reserver.
***
* Abstract
*    This function assumes that it is being handed a two dimensional  dynamic
* array (fields and values).   When complete it  will return a dynamic  array
* whose fields and values  have  been  swapped.    This  is  real  handy  for
* comparing and handling  transactions in  a multi-valued/associated  dynamic
* array.  If you use  this function, you will  want to remember to  re-invert
* the data before writing it back to the file.
***
* Revision Log
* Who..... When... Why.......................................................
* 21July96 Andrew  Initial coding.
*
***
 
$INCLUDE UPCASE.EQUATES
MoreDA = DA ne ""
NewDA = ""
Field = 0
Terminator = 1
loop while Terminator ne 0
   remove Item from DA setting Terminator
   Field += 1
   NewDA<Field,-1> = Item
* If REMOVE returns a Terminator value of 2 then it found a field mark.
   if Terminator eq 2 then Field = 0
repeat
return(NewDA)
end
