PRINT - The PRINT statement allows you to write data onto diskette files. It can only
be used with files opened in OUTPUT. UPDATE. or APPEND mode.
The PRINT statement has the following general form:
#file-number [,REC record-number][ :print-listl
Thefile-number
must be Included In the PRINT statement. The
record-number
may
optionally be included when writing to random-access (RELATIVE) files. The
print-list
Is also optional.
.file-number - Thefile-number
Is the number assigned to a particular
file by the OPEN statement.
Thefile-number
Is entered as a number
sign
(#)
followed by a number or a numeric expression that. when
rounded to the nearest integer. is a number from
1
to 255 and is the
number of a file that is open .
•
record-number
-
A
record-number
refers to the file record you want to
write. The
record-number
can only be specified for random files
(RELATIVE) .
•
print-list
-
The
print-list
is the list of values that you want to put on the
file. It consists of string or numeric variables or constants separated by
commas. colons. and semicolons.
The following are examples of PRINT statements.
PRINT #1 :X$
PRINT #23:X;A; "TIMES
4"
PRINT #1 1 .REC
44:
"TAX"
PRINT #3:A;B;C.
34
Puts the value of X$ Into the next position of the
file that was opened as
#1.
Puts the value of X. A. and "TIMES
4"
Into the
next record In the file that was opened as
#23.
Puts the string constant "TAX" Into record
number
44
of the file that was opened as
#1 1 .
Puts the values of A. B. and C into the next
three positions In the file that was opened as
#3.
The comma after C creates a pending print
condition. When the next PRINT statement Is
performed. one of the following actions occurs:
If the next PRINT statement has no REC clause.
the computer places the data Immediately
following the previous data.
If the next PRINT statement has a REC clause.
the computer writes the pending print record
onto the file at the position indicated by the
Internal counter and performs the new PRINT
statement as usual.
Summary of Contents for PHP1240
Page 1: ......