Skip to main content

%Library.Global

abstract class %Library.Global

Method Inventory

Methods

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 = "", ByRef Skipped As %String, Header As %String = "") as %Status
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.

    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.
    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
    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.

    Queries

    query Find(Namespace As %String, StartNode As %String, FindWhat As %String, MatchCase As %Boolean = 1, NameFormat As %Integer = 1, ValueFormat As %Integer = 1)
    Selects Name As %String, Value As %String, Name Format As %Integer, Value Format As %Integer
    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.
    query Get(Namespace As %String, SearchMask As %String, LastNode As %String, NameFormat As %Integer = 1, ValueFormat As %Integer = 1, GetPermissions As %Integer = 0)
    Selects Name As %String, Value As %String, Name Format As %Integer, Value Format As %Integer, Permissions As %String
    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)
  • FeedbackOpens in a new tab