Thank you Rupert, the code could save a significant amount of time, getting the ID requires a query but it should not be too complicated.
Sunshine, thank you for the tip. We tried the matrix, this was my first attempted solution, but hit several problems:
1) the source and target are the same package, at least for associations,
2) there are way too many elements and the resulting matrix is huge, something in excess of 1,000 by 1,000; Sparx EA struggles badly with it,
3) we considered filtering the matrix by diagram or non-blank/empty alias, but it may not be possible/easy,
4) ideally we need the alias, which cannot be added to the matrix, though a colleague working with me has found a temporary work around, and
5) the matrix does not retain the column heights and widths.
Still hoping Sparx Systems perfects the matrix functionality and makes it less frustrating.