Skip to main content

%Library.Global

Class %Library.Global [ Abstract, System = 4 ]

Methods

DoubleInnerQuotes

ClassMethod DoubleInnerQuotes(str As %String, ByRef ov As %Boolean) As %String [ Internal ]

Eval

ClassMethod Eval(x) As %String [ Internal, ProcedureBlock = 0 ]

Export

ClassMethod Export(Nsp As %String = {$namespace}, ByRef GlobalList As %String, FileName As %String, OutputFormat As %Integer = 5, RecordFormat As %String = "V", qspec As %String = "d", Translation As %String = "<Device Default>", ByRef Skipped As %String, Header As %String = "") As %Status [ PublicList = (G, IOT, blkcnt, blocks, write, %UI) ]

Exports a list of globals GlobalList from a namespace Nsp to FileName using OutputFormat and RecordFormat.

GlobalList is a comma delimited string or a local array, containing the names of the globals to export. A leading ^ and trailing type of .gbl on each global name are optional.

Block format (%GOF - type 7) cannot be used to export subscript mapped globals or globals which are mapped to a database other than the default global database of the namespace. If a mapped global is included in the GlobalList, it will be dropped and a message that it well be skipped is displayed. Use ISM/ObjectScript format to export mapped globals.

OutputFormat has the following values:

  • 1 - DTM format
  • 3 - VAXDSM format
  • 4 - DSM11 format
  • 5 - ISM/ObjectScript format
  • 6 - MSM format
  • 7 - Block format (%GOF)

RecordFormat has the following values:

  • V - Variable Length Records
  • S - Stream Data

Header is the user supplied header to be written in the file. Avoid putting $C(13,10) or '~Format=' string in the header string. If it is not supplied or is a null string then the default header is:
'Export of nnn globals from Namespace AAA', the maximum length of the header string is 30000, if the passed header is longer than 30000 characters then it will be truncated.

For information on qSpec, see System Flags and Qualifiers.

GetFileFormat

ClassMethod GetFileFormat(FileName As %String, ByRef Format As %String, ByRef RecordFormat As %String, DefaultFormat As %String = "5", DefaultRecordFormat As %String = "V") As %Boolean [ Internal ]

GetFileHeaderString

ClassMethod GetFileHeaderString(ByRef Header As %String, FileName As %String, InputFormat As %Integer = 5, VariableLength As %Integer = 1) As %Status

Get the Header string from an exported FileName file.
This method attempts to detect the file format from its header. If this fails, then the format parameters passed in are used.
Header is returned header string in the exported file.
FileName is the file name of the exported file.
InputFormat has the following values:

  • 1 - DTM format
  • 3 - VAXDSM format
  • 4 - DSM11 format
  • 5 - ISM/ObjectScript format
  • 6 - MSM format
  • 7 - Block format (%GOF)

VariableLength non-zero if record format is variable length. The default value is 1.

GetFileHeader

ClassMethod GetFileHeader(ByRef Header As %String, ByRef GblList As %List, FileName As %String, InputFormat As %Integer = 5, VariableLength As %Integer = 1) As %Status [ Internal ]

GetGlobalList

ClassMethod GetGlobalList(Header As %String) As %List [ Internal ]

GetOpenParms

ClassMethod GetOpenParms(Write As %Boolean, Variable As %Boolean = 1, Encoding As %String = "", Format As %Integer = 5) As %String [ Internal ]

Construct file Open parameters bWrite = open file for write access bVariable = read/write Variablelength/Stream record (True="V"\False="S") sEncoding = character encoding for \k???\ syntax Return parameters string

Import

ClassMethod Import(Nsp As %String = {$namespace}, GlobalList As %String, FileName As %String, InputFormat As %Integer = 5, VariableLength As %Integer = 1, NewName As %String = "") As %Status [ PublicList = (RMSMAXLEN, blkcnt, blocks, endian, version, vol, write, %UI, %gifmsg, Vmode, bigendian, file, gbl, globalList, load, nspace, reads, return, type, var, zu93type, odd, rsub, glreads, rdata) ]

Imports a list of globals GlobalList from FileName into namespace Nsp assuming the file was written in InputFormat with record format of VariableLength.

The Import method attempts to detect the file format from its header. If this fails, then the format parameters passed in are used.

GlobalList is "*" to import all globals or it should contain a comma delimited string containing the names of the specific globals to import. A leading ^ and trailing type of .gbl around each name are optional.

GlobalList is ignored for non Block format (%GOF) - Type #7 - files.

NewName is used to specify a new name for the global being imported. The input file must be type #7 (%GOF - Block format) and the file must contain only a single global.

InputFormat has the following values:

  • 1 - DTM format
  • 3 - VAXDSM format
  • 4 - DSM11 format
  • 5 - ISM/ObjectScript format
  • 6 - MSM format
  • 7 - Block format (%GOF)

VariableLength non-zero if record format is variable length. The default value is 1.

ListDump

ClassMethod ListDump(list As %List, level As %Integer, ByRef ov As %Boolean, Flags As %Integer = 0) As %String [ Internal, ProcedureBlock = 0 ]

Quote

ClassMethod Quote(str As %String, gvn As %Boolean = 0, ByRef ov As %Boolean, Flags As %Integer = 1) As %String [ Internal ]

This method quotes gvns or values so they can be printed. The default behavior is to quote a value. You must pass in gvn=1 to quote a gvn. In this case, the quoting is applied to the global name and to each subscript.

Numbers need no quoting and are returned unchanged.

Strings of printable characters are returned enclosed in quotes. If the string contains a quote character itself, the quotes are doubled to keep it a valid COS string.

A string that is a valid $list is converted to a valid COS expression that evaluates to the original string, for instance $lb(1,3.14,"test").

A string that contains control characters is converted to a valid COS expression that evaluates to the original string, for instance "test1"_$c(7)_"test2".

A string that is a valid $bit string is converted to a COS expression using $C() or $ZWC(). A comment is added indicating which bits are set.

Flags - option
Bit 0 - Format string
Bit 1 - Highlight String
Bit 2 - Write String to current device
Bit 3 - Do not add a comment to $Bit strings and %Status values

The ov argument is set to 1 if the formatted string has to be truncated because it is too long for a local variable.

QuoteVector

ClassMethod QuoteVector(str As %String, gvn As %Boolean = 0, ByRef ov As %Boolean, Flags As %Integer = 1) As %String [ Internal ]

UndoubleInnerQuotes

ClassMethod UndoubleInnerQuotes(str As %String) As %String [ Internal ]

Unquote

ClassMethod Unquote(str As %String, gvn As %Boolean = 0) As %String [ Internal ]

Undoes the effects of the Quote method. That is, given the gvn and value display strings, Unquote returns a gvn and a value that can be used in a set command like Set @gvn=value. The default behavior is to Unquote a value. To Unquote a gvn you must pass in gvn=1.

FindExecute

ClassMethod FindExecute(ByRef qHandle As %Binary, Namespace As %String, StartNode As %String, FindWhat As %String = "", MatchCase As %Boolean = 1, NameFormat As %Integer = 1, ValueFormat As %Integer = 1) As %Status [ Internal ]

The query returns the nodes that contain FindWhat, one node per row, with four columns, namely Name, Value, Name Format and Value Format.
Use ##Class(%Library.Utility).Replace to replace FindWhat with ReplaceWith.
NameFormat:

  • 1 - String format, this is the value of the subscript unaltered
  • 2 - ObjectScript format, the value has been converted into the ObjectScript representation for easy viewing, for example instead of showing the binary value a list is displayed as '$lb(1,"test")'. This format is suitable as the argument of $name.

ValueFormat:

  • 1 - String format, this is the value unaltered
  • 2 - ObjectScript format, the value has been converted into the ObjectScript representation for easy viewing, for example instead of showing the binary value a list is displayed as '$lb(1,"test")'. On output, Name Format and Value Format may assume a third value, namely 3, which means "Not editable". Due to issues with the length of this data not all of it can be displayed so a portion is displayed.

FindFetch

ClassMethod FindFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal, PlaceAfter = FindExecute ]

FindClose

ClassMethod FindClose(ByRef qHandle As %Binary) As %Status [ Internal, PlaceAfter = FindExecute ]

GetExecute

ClassMethod GetExecute(ByRef qHandle As %Binary, Namespace As %String, SearchMask As %String, LastNode As %String, NameFormat As %Integer = 1, ValueFormat As %Integer = 1, GetPermissions As %Integer = 0) As %Status [ Internal ]

The query returns the nodes selected by SearchMask, one node per row, with four columns, namely Name, Value, Name Format and Value Format.
NameFormat:

  • 1 - String format, this is the value of the subscript unaltered
  • 2 - ObjectScript format, the value has been converted into the ObjectScript representation for easy viewing, for example instead of showing the binary value a list is displayed as '$lb(1,"test")'. This format is suitable as the argument of $name.

ValueFormat:

  • 1 - String format, this is the value unaltered
  • 2 - ObjectScript format, the value has been converted into the ObjectScript representation for easy viewing, for example instead of showing the binary value a list is displayed as '$lb(1,"test")'. On output, Name Format and Value Format may assume a third value, namely 3, which means "Not editable". Due to issues with the length of this data not all of it can be displayed so a portion is displayed.
    GetPermissions: Note that returning permissions on an individual global will affect performance of the query.
  • 0 - Return "" for permission (no performance penalty)
  • 1 - Return permissions (READ,WRITE,USE)

GetFetch

ClassMethod GetFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal, PlaceAfter = GetExecute ]

GetClose

ClassMethod GetClose(ByRef qHandle As %Binary) As %Status [ Internal, PlaceAfter = GetExecute ]