Article
Mike Kadow · Jul 4, 2016 2m read

NewBie's Corner Session 10 Routines and Studio

NewBie's Corner Session 10 Routines and Studio

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

InterSystems Caché provides a GUI (Graphical User Interface) based Integrated Development Environment (IDE) called Caché Studio. Developers can use Studio to create and maintain applications.

InterSystems has a new IDE called Atelier but that is for later.

A Routine is the name that Caché calls computer programs. A Routine consists of a number of lines of instructions to the computer; these instructions are called code. The execution of the lines of code normally flows from the top of a routine to the bottom.

To access Caché Studio from the Caché Cube select Studio.

Once Studio is up, from the File Menu (upper left) select New, (a popup entitled New will appear) then select General (under Categories) and then Caché ObjectScript Routine (under Templates). Hit Ok.

On the first line (right next to the 1), write "MyRoutine" (no quotes)

Hit the line feed (Enter), and the tab key and write Write "Hello There!" (including quotes)

Hit another line feed (Enter), and write "Quit" (no quotes)

From the File Menu select Save As and they write "MyRoutine" in the box to the right of "File name", (replacing Untitled1.mac), hit 'Save As' to the right

From the Build Menu, select compile

You have written your first routine.

Go back to the Caché Cube and select Terminal

And from the Terminal type "Do  ^MyRoutine" (no quotes)

And your routine should run.

Now you can go back to sessions 2 thru 8 and practice some of the things you learned to do on the terminal, but do them in your newly created routine.

--Mike Kadow

PaulMikeKadow@gmail.com

If you have a comment, please respond through the InterSystems Developer Community, don't send me private email, unless of course you wish to address me only.

See NewBie Index for an index of all NewBie Corner posts.

 

00
5 0 3 306
Log in or sign up to continue

Replies

Hi Mike,

I tried this, but I got an error:

MyRoutine.INT(2) ERROR #1002: Invalid character in tag : '"Hello there!"' : Offset:1 ["Hello^MyRoutine]

Here is what I wrote in my routine:

MyRoutine
"Hello there!"
quit

Can you tell me what is wrong? In addition, is routine in cache similar to Main() in C/C++/C#? And the language used is the same as writing a class, such as ObjectScript?

Thanks,

Hi Gaolai,

 

You need to type :-

 

write "Hello there!"

 

rather than :-

 

"Hello there!"

 

Godo luck

Steve

Gaolai,

You need leading whitespace on any line of a routine which is not a line tag.  Try putting a space or Tab on your 2nd and 3rd lines.

Also, "Hello there!" isn't a valid COS command.  Try using:

   Write "Hello There!"