12.07.2015 Views

Using Caché Globals - InterSystems Documentation

Using Caché Globals - InterSystems Documentation

Using Caché Globals - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SET ^a="The quick "SET ^A="brown fox "SET ^A7="jumped over "SET ^A.7="the lazy "SET ^A1B2C3="dog's back."WRITE ^a,^A,^A7,!,^A.7,^A1B2C3KILL ^a,^A,^A7,^A.7,^A1B2C3 // keeps the database cleanLogical Structure of <strong>Globals</strong>2.1.2 Subscript Naming Conventions and LimitsA global can have multiple named subscripts, identifying node levels. Subscripts have the followingnaming conventions:• A subscript name can be any numeric, or any quoted string, except the null string (""). It caninclude characters of all types, including blank spaces, non-printing characters, and Unicodecharacters. Subscript names are case-sensitive.• Standard numeric evaluation is performed on numeric subscript names, such as arithmetic andconcatenation operations and stripping leading and trailing zeros. String concatenation is performedon string subscript names.• A subscript name can be specified as a local or global variable, but that variable must be defined.Thus, the following are valid subscript names (note that the SET and WRITE command pairsdemonstrate equivalent subscript names:SET ^a(1)="So I've " ; leading and trailing zeros strippedWRITE ^a(001.00)SET ^a("2")="got " ; numeric and its string equivalentWRITE ^a(2)SET ^a(1+2)="that " ; arithmetic operations performedWRITE ^a(3)SET ^a(1_2)="going " ; concatenation performedWRITE ^a(12)SET ^a(0)="for " ; zero valid, extra zeros strippedWRITE ^a(00000)SET ^b="word",^a(^b)="me, " ; name as defined globalWRITE ^a("word")WRITE ! ; line break for readabilitySET ^a("short"_" "_"word")="which " ; string concatenationWRITE ^a("short word")SET ^a("!@#$%^&*")="is " ; punctuation charactersWRITE ^a("!@#"_"$%^&*")SET ^a(" ")="nice." ; blank space validWRITE ^a(" ")On a Unicode system, Unicode characters can also be valid subscript names:SET b=$CHAR(960),^a(b)="Carl Spackler" ; Unicode chars validWRITE ^a(b)You can specify a large number of subscript levels. The limitation on subscript levels is based on thetotal number of characters in the global reference. The total length of a global reference — the nameof the global plus all of its subscripts — is limited to 1023 encoded characters (which may be fewer<strong>Using</strong> <strong>Caché</strong> <strong>Globals</strong> 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!