9 Output Operations

Output Functions

Four functions are available to increase output formatting capabilities--TAB, SPA, LIN, and PAGE. The functions can be used in DISP, LDISP, and PRINT statements. Each function must be followed by either a comma or a semicolon (it makes no difference here).

NOTE: The statements TAB, SPA, LIN, and PAGE work with DISP and LDISP on the

The TAB Function

The TAB function causes the next item in the list to be output beginning in the specified column. Syntax is as follows:

TAB (charcter position)

The character position is any numeric expression, and is rounded to an integer. If it is less than 1, it defaults to 1. For example:

160  DISP 1;2;3;TAB(10),"BEGINNING OF 10th COLUMN"

1 2 3          BEGINNING OF 10th COLUMN
If the specified column has already been filled, a CRLF is output, and then the TAB is completed. For example, if the line above is changed to:


          BEGINNING OF 10th COLUMN
a CRLF would be output after 1 (notice that the comma causes it to be output in a 20-column field) and the text appears on the next line.

When the character position specified is greater than the number of columns in the standard printer, it is reduced by this formula:

character position MOD N

N being the number of columns specified as the standard printer width. If the character position is a multiple of the printer width, this formula returns a 0. In this case, the item is output in the last column which equals the printer width. For example, with a display width of 80:

180  DISP TAB(10),1;TAB(90),2;TAB(170),3

The SPA Function

The SPA (space) function outputs the specified number of blank spaces, up to the end of the current line. Syntax is as follows:

SPA (number of spaces)

Here is an example:

190  DISP 1;SPA(10);2;SPA(10);3
200  DISP 1,SPA(10),2,SPA(10),3

1         2         3
1                    2                    3
The number of spaces is any positive numeric expression from 0 through 32767, and is rounded to an integer. If it specifies more blanks than remain in the line, the next item begins the next line. For example:

210  Ast$="**********"
220  DISP Ast$;TAB(70);Ast$;SPA(20);Ast$

**********                                             **********

The LIN Function

The LIN function causes the specified number of linefeeds to be output. Syntax is as follows:

LIN (number of linefeeds)

The number of linefeeds is any numeric expression, and is rounded to an integer. Its range is from -32768 through 32767.

Here is an example:

230  INPUT "DATE:";Date$
240  DISP "DATE:";Date$,LIN(5),"END OF PROGRAM",LIN(5)

DATE:April 23rd

When the number of linefeeds is positive, a carriage return is also output. When 0 is specified, only a carriage return is output.

When the number of linefeeds is negative, no carriage return is output and the number of linefeeds output equals the absolute value of the expression. For example:

10   DISP "TODAY";LIN(-2);"IS";LIN(-2);"FRIDAY"




The PAGE Function

The PAGE function causes a form feed to be output, so further printing can begin on a new page or at the top of the next form on devices that respond to ASCII form feed (CHR$(12)). The syntax is as follows:


Here is an example:

130 Heading:  ! print catalog header.
140   PRINT PAGE,Cat$(1)
150   PRINT Cat$(2);LIN(1)
When the standard printer is the display, PAGE scrolls the display buffer up to position the cursor at the top of the display.

Here is a short program which uses some of the output function to repeatedly output a string diagonally across the display:

20   Column=1
30   FOR Line=1 TO 10
40     DISP SPA(Column);"Eloquence"
50     Column=Column+3
60   NEXT Line
70   END


Eloquence Language Manual - 19 DEC 2002