HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4-: 157
Entering a WHILE loop from a statement other than the WHILE statement is
considered to be a bad programming practice, and is not recommended. Use
of a GOSUB or CALL statement from within a WHILE loop can be useful.
100 PRINT "Sum of the odd numbers 1 to 150 is: "
110 N=1
120 Sum=0
130 WHILE 150-N !Begin loop
140 IF N MOD 2 THEN CALL Odd(Sum,N)
150 N=N+1
160 ENDWHILE !End loop
170 PRINT Sum
180 END
190 !
200 SUB Odd(Sum,N) !Return to loop
210 Sum=Sum+N
220 SUBEND !Return to next line following CALL
WORKFILE IS
The WORKFILE IS statement identifies the file, called a workfile, that
holds the record pointers of the selected records in the database. This
statement is global in nature and deactivates any previously defined
workfile. The file designated as the workfile must be open. The
workfile itself must be a binary file with record size (in words) equal
to twice the number of data sets in the THREAD IS statement. It must be
defined before the SORT or SEARCH statement is executed. Since the
workfile is, by definition, a user-defined file, it is subject to the
same rules and restrictions that apply to HP Business BASIC/XL files. In
addition, open it with both read and write capability.
Syntax
WORKFILE IS
#fnum
Parameters
fnum
A numeric expression that evaluates to a positive short
integer greater than zero. The value is the same as
that used to open the workfile.
Examples
100 ASSIGN #1 TO "filex" !File #1 is filex
200 WORKFILE IS #1 !filex is the workfile
WRITE FORM
The WRITE FORM can be used to display the value of an HP Business
BASIC/XL variable in a field of a VPLUS form, position the cursor, or
write to the message window of the VPLUS form. It is possible to do any
combination of these operations in a single statement.
Syntax
WRITE [TO] FORM
[ [{,} ]]
[
form_item
[{;}
form_item
...]]
[{,} ]
[{;} CURSOR [=]
cursor_expr
]
[{,} ]
[{;} MSG [=]
message_expr
]
form_item
->
{
form_element
|
for_clause
|
skip_clause
}