HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

6- 19
Examples
Legal:
500 PRINT USING 310
510 IMAGE 30X,"Title"
Illegal:
600 PRINT USING "30X,"Title""
If
num_expr
has the value
n
and the corresponding output item is a string
of length
s
, then:
If DISP USING or PRINT USING statement prints
n
=
s
Entire string
n
<
s
First
n
characters of the string
n>s
Entire string, followed by
n-s
blanks
Examples
99 S$="GOODBYE"
100 DISP USING "7A"; S$ !Format length = output string length.
110 DISP USING "4A"; S$ !Format length < output string length.
120 DISP USING "8A"; S$ !Format length > output string length.
130 DISP USING 140; S$
140 IMAGE 7A,"TO YOU" !image contains literal.
150 DISP USING "4AX3A"; S$ !Insert blank in printed string.
Where "Å" represents a blank, the above program prints:
GOODBYE
GOOD
GOODBYEÅ
GOODBYETO YOU
GOOD BYE
Standard Format Specifier
A standard format specifier represents one string or numeric value of any
size. It consists of one symbol, K. If K represents a string value, the
DISP USING or PRINT USING statement prints the entire string. If K
represents a numeric value, the statement prints the value in the
standard format, without leading or trailing blanks.
Syntax
K
Examples
10 X=123
20 Y=.4567
30 Z=-1.234E+47
40 A$="cat"
50 B$="bird"
100 PRINT USING "K"; X
110 PRINT USING "K"; Y
120 PRINT USING "K"; Z
130 PRINT USING "K,K,K"; X,Y,Z
140 PRINT USING "K"; A$
150 PRINT USING "K,K"; A$,B$
160 PRINT USING "K,K,K,K,K"; X,A$,Y,B$,Z
999 END