STBL() Function - Global String Table

Syntax

STBL(str1{,str2}{,ERR=lineref})

Description

The STBL() function allows the program to maintain strings that are independent of the workspace and cannot be destroyed by CLEAR, BEGIN, or START. However, these strings are not shared between tasks. The STBL() function is used to maintain these global strings. There are two forms of the STBL() function:

Assign global string

The following example creates a global string called "NAME" and gives it the current value of B$. The STBL() function returns the value of B$ as its result. The string name (or "tag") may be any character sequence up to 32 characters. The value stored in a global string may be any length. If a global string with the same name already exists, it is overwritten with the new value.

1000 LET DUMMY$=STBL("NAME",B$)

Retrieve global string value

The following example locates a global string called "NAME" and returns its value to A$.

2000 LET A$=STBL("NAME")

Some special housekeeping operations are also supported:

Example 1

The following removes the string called "NAME" from the global string area.

1000 LET DUMMY$=STBL("!CLEAR","NAME")

Example 2

The following removes the string called "NAME" and any other strings that were created or updated since "NAME" was last assigned. This allows an application to "mark" the global string list and clean up later, if desired.

1000 LET DUMMY$=STBL("!CLEARTO","NAME")

Example 3

The following example returns a list of all names in the global string area. The names are in most recent to oldest order, separated with $00$.

1000 LET DUMMY$=STBL("!LIST")

Example 4

The following removes all global strings (with the exceptions below).

1000 LET DUMMY$=STBL("!CLEARALL")

In addition to maintaining small amounts of data for use by several applications, STBL() allows PRO/5 to be customized (such as loading foreign language upper/lower case tables). Read more about these customizations in the STBL Formats section of the User's Reference Guide and use string names beginning with a "!". Therefore, avoid names beginning with "!". Global strings with names that begin with "!" will not be removed by "!CLEARTO" or "!CLEARALL" but can be removed individually with "!CLEAR".

Example 5

The following loads the field terminator table.

LET DUMMY$=STBL("!TERMS",B$)

Example 6

The following loads the character type and case table.

LET DUMMY$=STBL("!CTYPE",B$)

Example 7

The following sets PRO/5's editor command table.

LET DUMMY$=STBL("!EDIT",B$)

Example 8

The following sets PRO/5's date string table.

LET DUMMY$=STBL("!DATE",B$)

See Also

Functions - Alphabetical Listing