Skip to main content

Do Command

You just saw examples of some ObjectScript commands. Let's start with Do, which you use to run code. You just saw do ##class(ObjectScript.RightTriangle).Main() which ran the Main() class method. For another demonstration, let's look at the system routine that displays database free space, %FREECNT. You run it by using Do, making sure to place the ^ (caret) character before the name of the routine. In the example below, %FREECNT displays the freespace in the USER database only.

In addition, you can run code within a routine (called a procedure) by referring to the label/tag of the line where the procedure begins within the routine. You place the label right before the caret. In the example, the ALL procedure of %FREECNT displays the free space for all databases.

InterSystems IRIS system routines that start with the % character can be called from any namespace. Routine names and labels are case-sensitive.

Terminal


USER>do ^%FREECNT

Databases Selected
------------------
/usr/irissys/mgr/user/
Device: 
Right margin: 80 => 

                              Database Free Space
                              Feb 28 2018  5:50 PM
Database                           Max Size  Size    Available %Free   Disk Free
/usr/irissys/mgr/user/             Unlimited 11MB    2.5MB     22.72   56.01GB

USER>do ALL^%FREECNT                                                                    

Databases Selected
------------------
/usr/irissys/mgr/
/usr/irissys/mgr/enslib/
/usr/irissys/mgr/irisaudit/
/usr/irissys/mgr/irislib/
/usr/irissys/mgr/irislocaldata/
/usr/irissys/mgr/iristemp/
/usr/irissys/mgr/user/
Device: 
Right margin: 80 =>

                              Database Free Space
                              Feb 28 2018  5:51 PM
Database                           Max Size  Size    Available %Free   Disk Free
/usr/irissys/mgr/                  Unlimited 65MB    0.11MB    .16  <- 56.01GB
/usr/irissys/mgr/enslib/           Unlimited 163MB   14MB      8.58    56.01GB
/usr/irissys/mgr/irisaudit/        Unlimited 1MB     0.27MB    27      56.01GB
/usr/irissys/mgr/irislib/          Unlimited 375MB   0.74MB    .19  <- 56.01GB
/usr/irissys/mgr/irislocaldata/    Unlimited 1MB     0.27MB    27      56.01GB
/usr/irissys/mgr/iristemp/         Unlimited 11MB    8.8MB     80      56.01GB
/usr/irissys/mgr/user/             Unlimited 11MB    2.5MB     22.72   56.01GB

USER>

FeedbackOpens in a new tab