TK-Works Manual

TK-WORKS MANUAL
table of contents

(main)

GLOBAL UTILITIES

PRINT GLOBAL LISTINGS

This utility enables the printing of the contents and structure of globals.

Step 1 From the Functions menu, select Utilities.
From the Utilities menu, select Global.
From the Global Utilities, select List.
Step 2 Select the global to be listed. TK-WORKS' global listing utility provides several powerful features that enable you to print as much, or as little, of the selected global as you need. The following examples, which can also be used in combination, should help illustrate how to make your request.
^GLO Print entire global
^GLO("A", Print descendants of first level node "A"
^GLO("A":"E", Print descendants of first level nodes from "A" to "E" inclusive
^GLO() Print all nodes at first level of global
^GLO(,,) Print all nodes at first three levels of global
Step 3 Select the output device, and its left and right margins. Additional information regarding selection of output device and margins is provided at the beginning of the Routine Utilities section under Conventions.

EDIT/DISPLAY GLOBAL

This page-oriented global editor provides the ability to display all or portions of the selected global, page forward from the starting reference and back, and even screen out nodes in which you have no interest. Further it allows you to interactively add new nodes and edit or delete existing ones.

Step 1 From the Functions menu, select Utilities.
From the Utilities menu, select Global.
From the Global Utilities, select Edit.

Or, you can call up the GLOBAL EDITOR directly from the programming prompt by typing: D ^%TKEDGE

Step 2 Select the global to be displayed. TK-WORKS' Global Editor provides a powerful masking feature that allows you display as much, or as little, of the selected global as you need. This masking abides by several rules.

Rule 1: Subscripts do not need surrounding quotations marks unless they contain a comma or colon. However, if quotes are used, they must be paired. Examples:
^GLO(A) Is the same as ^GLO("A")
^GLO("1A") Could have been ^GLO(1A)
^GLO(A:Z) Is the same as ^GLO("A":"Z")

Rule 2: Global references which have a closing parenthesis will limit the number of levels of the global to be displayed. Once displayed, the number of levels can be changed interactively. When using the closing parenthesis, a null subscript will select all all subscripts at the requested level. Examples:

^GLO() Display all nodes at top level
^GLO(,,) Display all nodes at top three levels
^GLO(A,) Display all nodes at top two levels in which "A" is top level subscript.
^GLO(A:E,) Display all nodes at top two levels in which the top level is "A", or follows "A", but precedes "E".
^GLO(,A) Display all nodes at top two levels in which the second level subscript is an "A".
^GLO(11025,,1990) Display all nodes at top three levels in which the top level subscript is "11025" and the third level subscript is 1990.

Rule 3: Global references without a closing parenthesis will display all existing levels of the global. Once displayed, the number of levels can be reduced interactively. When not using the closing parenthesis, a null subscript will select all all subscripts at the requested level. Examples:
^GLO Display entire global
^GLO("A", Display only descendants of first level node "A"
^GLO("A":"E", Display descendants of first level nodes with values that equal or follow an "A", and equal or precede an "E"
When you have specified the portion of the global to be displayed, the first page of the global display will be shown. The following screen illustrates a global where the starting reference was ^TEST() , meaning to display only the first level of the global.

Notice that the reference to each node is displayed at the left margin and its data displayed to its right. If the data is too long to fit on one row it is truncated and three periods are displayed on the right edge. If the node is a pointer node only, and has no data of its own, "<ptr> " is displayed in place of data.

If your terminal supports 132 column mode, you can interactively switch from 80 column to 132 column by pressing the greater-than "> " key. To switch back to 80 column mode, press the less-than "<" key.

The NEXT SCREEN and PREV SCREEN keys can also be used to display the next or previous page of the global. However, you will not be able to page backwards farther than your starting reference.

Another important feature of the Global Editor is the ability to interactively increase or decrease the number of levels of the global to be displayed.

To increase the number of levels, point to the node whose descendants you would like to view and press the cursor [RIGHT] key. The ^TEST global shown above might then look like this...

Likewise, to decrease the number of levels being viewed, press the cursor LEFT key.

You may also select a new starting reference when increasing the number of levels to be displayed. In the example above, the pointer was moved to ^(3) before the cursor RIGHT was pressed. This had the effect of making ^(3) the starting point for the expanded display.

Editing A Node To edit the contents of a node, move the pointer up or down the left margin until it is pointing to the node you wish to edit and press [RETURN]. The reference and data will be displayed as illustrated below to enable them to be edited.

Editing the reference. As you can see, you can edit a global reference as well as the data stored at the reference. Editing a reference has the effect of copying the data to a new reference and removing it from the original reference. If the original reference has descendants, they will be unaffected by the change.

Changes to a reference must be syntactically correct. TK-WORKS does not evaluate the modified reference to determine whether it is correct, and syntax errors will cause the program to be interrupted.

If no change is desired, simply press [RETURN].

Editing the data. After leaving the reference field, the cursor will be placed at the beginning of the data field, which, as illustrated in the example below consists of a three-row editing window at the bottom of the screen. This is a scrolling field, meaning that while there are only three rows displayed, additional rows may be reached using the cursor DOWN key.

To edit, move the cursor to the position where the change is to be made. You may use the INSERT CHARACTER or DELETE CHARACTER keys to insert or delete characters as necessary. When finished editing, press [RETURN]. The screen will be refreshed and you will be returned to display mode.

Note that while control characters are displayed in their decimal form above, here in the editing field, they are displayed as a period (".") and the decimal value is displayed in the lower left corner of the screen when the cursor is moved to the period.

To edit a control character, position the cursor on the period representing the character to be edited. The decimal value of the character will be displayed in the lower left corner, as shown above, and can be edited by pressing the SELECT key.


NOTE: You can determine which key is the SELECT key by pressing the HELP key. If you are unsure which key has been assigned to the HELP function, refer to the function key definitions provided in Appendix B.

The cursor will move to the lower left corner of the screen and permit the decimal value of the control character to be edited. Press [RETURN] when completed and the cursor will return to its prior position.

Deleting A Node You can quickly delete any node displayed on the screen by moving the pointer to it and pressing the DEL LINE key.

If the node is a simple data node and has no descendants, it will be deleted immediately and ""deleted"" displayed in place of the data on the screen. If the deletion was in error, and you have not changed display pages, you can retrieve the value by pressing [RETURN] and entering edit mode. The deleted value will be displayed, and by pressing [RETURN] through the edit, you will be able to restore the node to its original form.

If the node has any descendants, "<delete> " will be displayed on the screen next to it and any of its descendants which are also displayed on the screen, and you will be asked to confirm the deletion. If your answer is YES, the node and its descendants will be killed.

Finally, the screen will be refreshed and you will be returned to display mode.

Inserting A Node To insert a new data node into the global, press the INS LINE key.

You will first be asked for the reference of the node to be inserted. Enter the subscripts to be used, ensuring that they are syntactically correct and press [RETURN].

You will then be asked for the data to be inserted at the node. Enter the value and press [RETURN].

If at either question you would like to abort, simply press the EXIT key.

COPY GLOBAL

This utility enables an entire global or portions of a global to be copied to another global. Subscript substitution, where the original subscript is replaced with another, is also available, making it possible to copy nodes from one global to a different location within the same global.

The only restriction is that the data cannot be moved from one level to another. For example, if the data in the global being copied is at the fourth level, it will be at the fourth level of the destination global as well.

Step 1 From the Functions menu, select Utilities.
From the Utilities menu, select Global.
From the Global Utilities, select Copy.

Step 2 Select the global to be copied. TK-WORKS' global copy utility provides several powerful features that enable you to copy as much, or as little, of the selected global as you need. The following examples, which can also be used in combination, should help illustrate how to make your request.
^GLO Copy entire global
^GLO("A", Copy node "A" at the first level and its descendants
^GLO("A":"E", Copy nodes "A" through "E" of the first level and their descendants
^GLO() Copy all nodes at first level of global
^GLO(,,) Copy all nodes at first three levels of global
Step 3 Enter the name of the destination global. If subscript substitution is desired, enter the subscripts to be substituted at the appropriate level. Note that subscript substitution is not possible for levels in which a range has been specified, or for which no subscript has been specified.

After pressing return, the copy will begin and you will be periodically provided a reference indicating what node is being copied.