Try it like this:

/// d ##class(isc.test.Utils).Test2()
ClassMethod Test2()
{
    set from = "^A"
    set to = "^B"
    kill @from, @to
    set @from@(1) = "A"
    set @from@(2) = "B"
    set @from@(3) = "C"
    
    do ..InvertList(from, to)
    
    zwrite @from,@to
}

ClassMethod InvertList(from, to) As %Status
{
    #define ForAll(%in,%gn) s gn%in=$na(%gn) s %in="" f { s %in=$o(@gn%in@(%in)) q:%in=""
    #define EndFor }

    $$$ForAll(key, @from)
        set @to@(@from@(key))=key
    $$$EndFor
}

For me it returns

^A(1)="A"
^A(2)="B"
^A(3)="C"
^B("A")=1
^B("B")=2
^B("C")=3

Enjoy.

#define ForAll(%in,%gn) s gn%in=$na(%gn) s %in="" f { s %in=$o(@gn%in@(%in)) q:%in=""
#define EndFor  }

set glvn = "^MyGlobal"
$$$ForAll(value, @glvn)
    write value,!
$$$EndFor

Metrics can store history, i.e.:

Property MetricProperty As Ens.DataType.Metric (AUTOHISTORY=50) [MultiDimensional];

Docs.

Extend %Fileman class:

Class MyFilemanDate Extends %FilemanDate {

Parameter STRICTDATA = 1;

}

And call it:

##class(MyFilemanDate).LogicalToDate()

Documentation states there's an argument SubDir As %Boolean = 0 in ExportAllClassesIndividual  method.

Description: If SubDir is true then it will export sub-packages as subdirectories.

Try setting it to 1.

Classes extending %Persistent with default Storage have GetStored method for persistent properties.

SYS.Database in your case has custom storage, that's why this method does not exist.