function DoProcessing(Trans) declare function Build_Struct, ProcessAcctTran $insert Logical * count the number of transactions NumTrans = count(Trans<1>, @vm) + (Trans<1> # "") * dimension an array to hold the strings pointed to by each transaction dim Desc(NumTrans) * build the array of transaction records Array = "" Locked = "" for i = 1 to NumTrans * the structure contains a NULL pointer if there is no description or * a pointer to the description if there is one if len(Trans<3,i>) then Desc(i) = Trans<3,i> LockVariable Desc(i) as CHAR ;* ensure the pointer will not change Pointer = GetPointer(Desc(i)) Locked = TRUE$ end else Pointer = 0 ;* NULL in C/C++ is defined as 0 end * to build an array of structures, just build the structures and * concatenate them Array := Build_Struct("ACCTTRAN", Trans<1,i>, Trans<2,i>, Pointer) next i * call the DLL function Success = ProcessAcctTran(Array, NumTrans) * since we locked the decriptions so they would not move around in memory, * we must now unlock them for i = 1 to NumTrans if Locked then UnlockVariable Desc(i) end next i return Success