| Previous | Contents | Index |
The PRINT USING statement generates output formatted according to a format string (either numeric or string) to a terminal or a terminal-format file.
It is recommended that you use compile-time constant expressions for str-exp whenever possible. When you do this, the BASIC compiler compiles the string at compilation time rather than at run time, thus improving the performance of your program. |
You cannot specify the dollar sign ($$), asterisk-fill (**), and zero-fill (<0>) formats within the same print field. Similarly, BASIC does not allow you to specify the zero-fill (<0>) and the blank-if-zero (<%>) formats within the same print field. |
| $$### | Forms one field and reserves five spaces |
| **## | Forms one field and reserves four spaces |
| <0>#### | Forms one field and reserves five spaces |
| <%>### | Forms one field and reserves four spaces |
| $$<%>### | Forms one field and reserves six spaces |
| **<%>## | Forms one field and reserves five spaces |
PRINT USING "###.###",-12.345 PRINT USING "##.###",12.345 |
Output
-12.345 12.345 |
INPUT "Your Name";Winner$
Jackpot = 10000.0
PRINT USING "CONGRATULATIONS, 'EEEEEEEEE, YOU WON $$#####.##", Winner$, Jackpot
END
|
Output
Your Name? Hortense Corabelle CONGRATULATIONS, Hortense Corabelle, YOU WON $10000.00 |
The PROD$ function returns a numeric string that is the product of two numeric strings. The precision of the returned numeric string depends on the value of an integer argument.
DECLARE STRING num_exp1, &
num_exp2, &
product
num_exp1 = "34.555"
num_exp2 = "297.676"
product = PROD$(num_exp1, num_exp2, 1)
PRINT product
|
Output
10286.2 |
The PROGRAM statement allows you to identify a main program with a name other than the file name.
PROGRAM first_test . . . END PROGRAM |
The PUT statement transfers data from the record buffer to a file. PUT statements are valid on RMS sequential, relative, and indexed files. You cannot use PUT statements on terminal-format files or virtual array files.
!Sequential, Relative, Indexed, and Virtual Files PUT #3, COUNT 55% |
!Relative and Virtual Files Only PUT #5, RECORD 133, COUNT 16% |
| Previous | Next | Contents | Index |