VA FileMan V. 22.2 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Database Server (DBS) API


MSG^DIALOG(): Output Generator

Reference Type Category ICR #
Supported Database Server (DBS) 2050
Description

The MSG^DIALOG API takes text from one of the VA FileMan dialog arrays (for errors, help text, or other text) or from a similarly structured local array, writes it, and moves it into a simple local array.

The subscripting of these arrays tells the developer whether the dialog is:

Different combinations of these messages can be returned from the DBS calls. In addition, error messages are returned whenever an error occurs, either in the way the call was made or in attempting to interact with the database.

With the DBS calls, it becomes the job of the developer to display dialog to the end-user as needed, perhaps in a Graphical User Interface (GUI) box or in the bottom portion of a screen-oriented form. The developer can also save error messages in a file.

The MSG^DIALOG API is designed to make it easier for the developer to use the dialog arrays. The developer can use the MSG^DIALOG API to do simple formatting of the dialog and to either write dialog to the current device or to move the dialog to a simple local array for further processing.

Format
MSG^DIALOG([flags][,.output_array][,text_width][,left_margin][,input_root])
Input Parameters
FLAGS

(Optional) Flags to control processing. If none of the text-type flags (E, H, or M) is entered, the routine behaves as if E were entered. If no flags are entered, it behaves as if the flags contained WE. The possible values are:

A Local Array specified by the second parameter receives the text.
W Writes the text to the current device.
S Saves the ^TMP or other designated input array (does not KILL the array).
E Error array text is processed.
H Help array text is processed.
M Message array text (other text) is processed.
B Blank lines are suppressed between error messages.
T Return Total number of lines in the top-level node of the local array specified by the second parameter.
.OUTPUT_ARRAY

(Optional) This parameter contains the name of the local array to which the text is to be written. If flags contains an A, this parameter must be sent; otherwise, the parameter is ignored.

NOTE: The output array is KILLed before the text is added, not appended to what is already there.

TEXT_WIDTH

(Optional) Maximum line length for formatting text. If specified, the text is broken into lines of this length when writing to the current device or when moving the text to the output_array. Lines are not “joined” to fill out to this width.

If you do not specify text_width:

  • Text that is displayed on the current device is formatted to a line length of IOM-5 if IOM is defined; otherwise, 75 characters.

    NOTE: IOM is the right margin, and it is a Kernel variable defined by a call to the Device Handler, ^%ZIS.

  • Text written to an output_array is not reformatted.
LEFT_MARGIN

(Optional) Left margin for writing text. If sent, the text is lined up in a column starting at this column number; otherwise, the text is lined up with the left margin (column 0). This parameter has no effect on text sent to an array (A flag).

INPUT_ROOT

(Optional) Closed root of local input array in which text resides. If the text resides in a local array, this parameter must be sent. The last non-variable subscript of the local array must describe the type of text it contains, as the ^TMP global normally does:

  • “DIERR”—For errors.
  • “DIHELP”—For help text.
  • “DIMSG”—For other text.
Output

If W is passed in the flags parameter, the text is written to the current device. If A is passed in the flags parameter, the text is written to the local array whose name is specified in the second parameter. The format of that array is:

ARRAY

Total number of lines (only returned if the T flag is passed in the flags parameter).

ARRAY(n)

A line of formatted text (n = sequential integer starting with 1).

If the flags parameter does not contain S, then the input array and associated local variables (DIMSG, DIHELP, and DIERR) are KILLed.

NOTE: To add entries to the DIALOG (#.84) file, you must use a numberspace assigned by the database administrator (DBA).

REF: For more information on the DIALOG (#.84) file, see the “DIALOG File” section.

Examples

Example 1

In this first example (Figure 137), you want to write the error text to the current device and KILL the input array. Notice that because no flags are sent to the call, the default flags for Write Error message (WE) are assumed. Thus, the call writes the single error message “The record is currently locked,” from the “DIERR” portion of the ^TMP global. It also KILLs ^TMP(“DIERR”,$J) and the local variable DIERR as follows (Figure 137):

Figure 137: MSG^DIALOG API—Example 1: “DIERR” Portion of the ^TMP Global

    ^TMP("DIERR",698526778,1) = 110
    ^TMP("DIERR",698526778,1,"TEXT",1) = The record is currently locked.
    ^TMP("DIERR",698526778,"E",110,1) =

    ^TMP("DIHELP",698526778,1) = This number is used to determine how large to
        make the generated
    ^TMP("DIHELP",698526778,2) = compiled PRINT TEMPLATE routines. The size must be a
        number greater
    ^TMP("DIHELP",698526778,3) = than 2400, the larger the better, up to the maximum
        routine size for
    ^TMP("DIHELP",698526778,4) = your operating system.

    ^TMP("DIMSG",698526778,1) = Records from list on ZZMYARRAY SEARCH template.

Then, write the error text to the current device and KILL the input array as shown in Figure 138:

Figure 138: MSG^DIALOG API—Example 1: Input and Output

    >D MSG^DIALOG()
    The record is currently locked.

Example 2

In this example (Figure 139 and Figure 140), you want to write the help text from the “DIHELP” subscripted portion of the ^TMP global, both to the current device and to the local “MYARRAY” array. In addition, you want to format each line to 50 as follows (Figure 139):

Figure 139: MSG^DIALOG API—Example 2: Input

    >D MSG^DIALOG("HAW",.MYARRAY,50,5)

This number is used to determine how large to make the generated compiled PRINT template routines. The size must be a number greater than 2400, the larger the better, up to the maximum routine size for your operating system.

Figure 140: MSG^DIALOG API—Example 2: Output

    >ZW MYARRAY
    MYARRAY(1)=This number is used to determine how large to
    MYARRAY(2)=make the generated
    MYARRAY(3)=compiled PRINT TEMPLATE routines. The size must
    MYARRAY(4)=be a number greater
    MYARRAY(5)=than 2400, the larger the better, up to the
    MYARRAY(6)=maximum routine size for
    MYARRAY(7)=your operating system.

Example 3

In the third example (Figure 141), help text was returned from a DBS call in a local array. This was done because the developer specified to the DBS call that dialog was to be returned in its own local array rather than in the ^TMP global. Suppose the local array looks like this (Figure 141):

Figure 141: MSG^DIALOG API—Example 3: Sample Local Array with Help Text Returned

    MYHELP("DIHELP",1)=This number is used to determine how large to make the
        generated
    MYHELP("DIHELP",2)=compiled PRINT TEMPLATE routines. The size must be a number
        greater
    MYHELP("DIHELP",3)=than 2400, the larger the better, up to the maximum routine
        size for
    MYHELP("DIHELP",4)=your operating system.

If the developer wishes to write the text to the current device and to preserve the “MYHELP” local array, the call and the results look like this (Figure 142):

Figure 142: MSG^DIALOG API—Example 3: Input

    >D MSG^DIALOG("WSH","","","","MYHELP")

This number is used to determine how large to make the generated compiled PRINT template routines. The size must be a number greater than 2400, the larger the better, up to the maximum routine size for your operating system.

Error Codes Returned

None.

 


Reviewed/Updated: May 2026