COLUMN
The COLUMN
operator
generates blanks.
Syntax
COLUMN position
- position is the column position (starts at 1).
Usage
The COLUMN
operator
is typically used in report routines to align data in PRINT
statements
and move the character position forward within the current line. This
operator makes sense when used in an expression with the comma append
operator: Spaces will be generated depending on the number of characters
that have been used in the expression, before the COLUMN
operator.
The COLUMN
operator
can be used outside report routines, in order to align data
to be displayed with a proportional font, typically in a TUI context.
For example, the next lines will always display the content
of the lastname variable starting from column 30 of
the terminal, no matters the number of characters contained in the firstname
variable. The example defines VARCHAR variables, since CHAR
variables are blank-padded, we would need to use the CLIPPED
operator:
DEFINE firstname, lastname VARCHAR(50)
DISPLAY firstname, COLUMN(30), lasttname
The pos operand
must be a non-negative integer that specifies a character position
offset (from the left margin) no greater than the line width (that
is, no greater than the difference (right margin - left margin). This
designation moves the character position to a left-offset, where 1
is the first position after the left margin. If current position is
greater than the operand, the COLUMN
specification
is ignored.
Example
PAGE HEADER
PRINT "Number", COLUMN 12,"Name", COLUMN 35,"Location"
ON EVERY ROW
PRINT customer_num, COLUMN 12, fname, COLUMN 35,city