9 Output Operations

Displayed Output (DISP)

NOTE: The DISP statement is available on HP-UX platforms, only.

The DISP (display) statement outputs text and variables on the display. Syntax is as follows:

DISP [display list]

The display list can contain one or more of the following:

Each item must be separated by either a comma or semicolon.

Here are some examples:

10   X=3.5
20   E$="SQUARED EQUALS"
30   DISP "X ";E$[9];X,"X ";E$;X^2

X EQUALS 3.5                 X SQUARED EQUALS 12.25

40   DISP 1,2,3,4
50   DISP 1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18

1                   2                   3                   4
1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18
The difference in spacing between numbers is controlled by use of commas and semicolons. When an item is followed by a comma, it is left-justified in a field 20 characters wide. Two or more commas after an item cause one or more character fields to be skipped. For example:


60   DISP 123456, ,654321

123456                                  654321
When an item is followed by a semicolon, no additional blanks are output. Remember that every number has a leading blank or minus sign and a trailing blank for spacing. For example:


10   STANDARD
20   GOSUB Disp
30   FIXED 3
40   GOSUB Disp
50   FLOAT 5
60   GOSUB Disp
70   STANDARD
80   GOTO 110
90 Disp:   DISP 123;.456;-789;-1.23E45
100        RETURN

123  .456 -789 -1.23e+45
123.000  .456 -789.000 -1.23E+45
1.23000E+02  4.56000E-01 -7.89000E+02 -1.23000E+45
When the display list ends with a comma or semicolon, any future DISP statement is appended to the current display line. For example:

110   INPUT "ENTER TODAY'S DATE:";Date$
120   DISP "TODAY'S DATE IS: ";
130   DISP Date$

TODAY'S DATE IS: Sept 22nd
If the output line is longer than the current display width, a carriage-return line-feed (CRLF) is normally output after every 80th character. This can be altered by assigning another line width via PRINTER IS. For example:

140   PRINTER IS 8,WIDTH(40)
sets the display line width to 40 characters. In this case, the new line width is in effect for successive DISP, PRINT, PRINT USING, and DISP USING output.

Below you find two examples concerning printing of User Defined Type variables.

In the example below, the Comment$ member variable from the Phone1 variable is displayed.

Phone1.Comment$="*Fancy Comment*"
DISP Phone1.Comment$
In addition to accessing single variables, you can specify the whole variable at once.

The example below displays all member variables of Phone1:

DISP STRUCT Phone1

Eloquence Language Manual - 19 DEC 2002