Home > Class Reference > ENSLIB namespace > %Library.Routine


stream class %Library.Routine extends %Library.CharacterStream, %Library.AbstractStream

The %Routine class provides a way to create and manipulate routines stored within the Caché database.

The %Routine class provides a stream interface (see %AbstractStream) that allows you to read existing routines as well as create new one programmatically.

%Routine includes methods to save and compile modified routines.

For example, the following code creates, saves, and compiles a simple Caché routine (note that lines of code start with a space character):

  Set routine = ##class(%Routine).%New("MyRoutine.MAC")
  ; Write lines of code to the routine
  Do routine.WriteLine("MyRoutine")
  Do routine.WriteLine("Tag()")
  Do routine.WriteLine(" Write ""This is my routine"",!")
  Do routine.WriteLine(" Quit")
  ; save the routine
  Do routine.Save()
  ; compile the routine
  Do routine.Compile()

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property Buffer as %Binary [ Private , MultiDimensional ];
Property methods: BufferGet(), BufferIsValid(), BufferSet()
property Generated as %Boolean [ InitialExpression = 0 ];
True if this routine is generated from something else
Property methods: GeneratedDisplayToLogical(), GeneratedGet(), GeneratedIsValid(), GeneratedLogicalToDisplay(), GeneratedNormalize(), GeneratedSet()
property IOLangMode as %Integer [ Private , InitialExpression = 0 ];
Property methods: IOLangModeDisplayToLogical(), IOLangModeGet(), IOLangModeIsValid(), IOLangModeLogicalToDisplay(), IOLangModeNormalize(), IOLangModeSet()
property IOLines as %Integer [ Private , InitialExpression = 0 ];
Property methods: IOLinesDisplayToLogical(), IOLinesGet(), IOLinesIsValid(), IOLinesLogicalToDisplay(), IOLinesNormalize(), IOLinesSet()
property IOSize as %Integer [ Private , InitialExpression = 0 ];
Property methods: IOSizeDisplayToLogical(), IOSizeGet(), IOSizeIsValid(), IOSizeLogicalToDisplay(), IOSizeNormalize(), IOSizeSet()
property IsModified as %Boolean [ InitialExpression = 0 ];
Property methods: IsModifiedDisplayToLogical(), IsModifiedGet(), IsModifiedIsValid(), IsModifiedLogicalToDisplay(), IsModifiedNormalize(), IsModifiedSet()
property LanguageMode as %Integer [ Calculated ];
The language mode of this routine
Property methods: LanguageModeDisplayToLogical(), LanguageModeGet(), LanguageModeIsValid(), LanguageModeLogicalToDisplay(), LanguageModeNormalize(), LanguageModeSet()
property Locked as %Integer [ InitialExpression = 0 ];
Number of times this routine has been locked.
Property methods: LockedDisplayToLogical(), LockedGet(), LockedIsValid(), LockedLogicalToDisplay(), LockedNormalize(), LockedSet()
property Name as %String [ Calculated ];
The name (without extension) of the routine associated with this object.

This is for backwards compatibility only.

Property methods: NameDisplayToLogical(), NameGet(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize(), NamespaceDisplayToLogical(), NamespaceGet(), NamespaceIsValid(), NamespaceLogicalToDisplay(), NamespaceLogicalToOdbc(), NamespaceNormalize()
property Namespace as %String [ Calculated ];
Return the namespace this routine is from
Property methods: NamespaceDisplayToLogical(), NamespaceGet(), NamespaceIsValid(), NamespaceLogicalToDisplay(), NamespaceLogicalToOdbc(), NamespaceNormalize()
property NodeNo as %String [ Private , InitialExpression = 0 ];
The current node we are reading from.
Property methods: NodeNoDisplayToLogical(), NodeNoGet(), NodeNoIsValid(), NodeNoLogicalToDisplay(), NodeNoLogicalToOdbc(), NodeNoNormalize(), NodeNoSet()
property Position as %Integer [ Private , InitialExpression = 2 ];
Property methods: PositionDisplayToLogical(), PositionGet(), PositionIsValid(), PositionLogicalToDisplay(), PositionNormalize(), PositionSet()