How to get database's free space programmatically
InterSystems FAQ rubric
You can see the free available space for the database using the radio button "Free Space View" in Management Portal: System Operation > Databases.
And it can be obtained programmatically by the FreeSpace query of the system class SYS.Database.
.png)
Here is an example of the code (created and executed in %SYS namespace):
/// ZISJ.mac
Set stmt=##class(%SQL.Statement).%New()
Set status=stmt.%PrepareClassQuery("SYS.Database","FreeSpace")
Set rs=stmt.%Execute()
While rs.%Next() {
Write !
For i=1:1:9 {
Write rs.%GetData(i),","
}
} Discussion (0)0