HELP may be obtained using the following keywords: CONSTANT VARIABLES DEBUG COMPILER COMMANDS FUNCTIONS 2 DEBUG Sorry, Not implemented yet. 2 COMPILER The following is a brief list of available complier commands. For more help type HELP BP2 'command'. APPEND BUILD COMPILE DELETE EXIT HISEG INENTIFY LIST LOCK NEW OLD RENAME REPLACE RUN SAVE SCALE SHOW UNSAVE 2 COMMANDS The following is a list of BP2 commands. For more help type HELP BP2 'command'. CALL CHAIN CHANGE CLOSE COMMON DATA DEF DIM END FIND FNEND FNEXIT FOR GET GOSUB GOTO IF INPUT INPUT KILL LET LSET MAP MAT_ PRINT MAT_READ MOVE NAME MEXT ONERROR ON_GOSUB ON_GOTO ON_THEN OPEN PRINT PRINT_# PRINT_USING PUT RANDOMIZE READ REM RESTORE RESUME RETURN RSET SCRATCH STOP SUB SUBEND SUBEXIT UNTIL UPDATE WHILE 2 FUNCTIONS This is a list of the available BP2 functions. For more help type HELP BP2 'function'. ABS ASCII ATN BUFSIZ CCPOS CHR$ COMP% COS CTRLC CVT$ DATE$ DET DIF$ ECHO EDIT$ ERL ERN$ ERR ERT$ EXP FIX FORMAT$ FSP$ FSS$ INSTR INT LEFT LEN LOT LOG10 MID$ NOECHO NUM$ NUM2 NUM1$ PI PLACE POS PROD$ QUO$ RAD$ RCTRLC RCTRL0 RECOUNT RIGHT RND SEG$ SGN SIN SPACE SQR STATUS STR$ STRING$ SUM$ TAB TAN TIME VAL XLATE 2 CONSTANT BASIC-PLUS-2 accepts three types of constants: floating-point, string, and integer. Floating-point constants are numbers in the range of 10E3810 2 GET GE GET # num exp [,KEY # num exp GT string exp] EQ The GET operation reads a record from a specified file into a buffer. On sequential files, GET operations are performed on succeeding records starting at the beginning of the file. Relative and Block I/O files allow the specification of a record number, and indexed files allow the specification of a key name. :EXAMPLE (GET) 50 GET #5% 2 GOSUB GOSUB line number The GOSUB statement transfers control to a subroutine that begins at a specified line number. :EXAMPLE (GOSUB (GO SUB)) 25 GOSUB 120 2 GOTO GOTO line number The GOTO statement unconditionally transfers control to a specified line number. :EXAMPLE (GOTO (GO TO)) 40 GOTO 85 2 IF IF conditional exp THEN line number ELSE line number statements statements GOTO line number The various forms of the IF statement allow branches in the program. The IF statement can also cause execution of statements except the following: DIM, REM, DATA, END, DEF, FNEND and SUB. :EXAMPLE (IF) 25 IF A=0 THEN PRINT "A EQUALS 0" 2 INPUT INPUT # expression, variable(s) The INPUT # statement acts very much as the INPUT statement. However, the INPUT # statement requests data from a terminal-format file rather than from you. :EXAMPLE (INPUT #) 25 INPUT #6% A,B,C 2 INPUT INPUT LINE ["string constant",] string variable(s) LINPUT ["string constant",] string variable(s) The INPUT LINE statement allows a character string to be input to a specified variable. The line terminator is included in the string with INPUT LINE but discarded with LINPUT. The optional string constant is printed before a question mark prompt for data. :EXAMPLE (INPUT LINE and LINPUT) 15 INPUT LINE A$, B$ See INPUT LINE # 2 KILL KILL string expression The KILL statement deletes a file from storage. :EXAMPLE (KILL) 10 KILL "SALARY.DAT" 2 LET LET variable(s)=expression variable(s)=expression The LET statement assigns constants and expressions to variables. The keyword LET is optional. :EXAMPLE (LET) 10 A=65 2 LSET LSET string variable(s) = string expression The LSET statement assigns string expressions to string variables. The data is left-justified and the length is not changed. :EXAMPLE (LSET) 10 LSET A$,B$ = X$+Y$ 2 MAP MAP (name) element(s) The MAP statement associates a named buffer with a file. Specified data in the element list is moved from the file to the buffer on a GET and from the buffer to the file on a PUT. :EXAMPLE (MAP) 10 MAP (Buff1) A%, B$, C 2 MAT_PRINT MAT PRINT array(s) The MAT PRINT statement outputs each element of a specified array. :EXAMPLE (MAT PRINT) 120 MAT PRINT A; 2 MAT_READ MAT READ array(s) The MAT READ statement reads the values into elements of a 1- or 2-dimensional array from a DATA statement. :EXAMPLE (MAT READ) 50 MAT READ B,C 2 MOVE MOVE FROM file exp, I/O list The MOVE statement moves data in a record to or from the variables you specify in the I/O list. :EXAMPLE (MOVE) 15 MOVE TO #5, A$, B, C(), FILL% 2 NAME NAME string1 AS string2 The NAME AS statement renames a file without changing the contents of the file. :EXAMPLE (MOVE AS) 15 NAME "MONEY" AS "ACCNTS" 2 MEXT NEXT variable The NEXT statement terminates a FOR, WHILE, or UNTIL loop. The variable must correspond with the variable in the initial FOR statement. Nested loops cannot cross each other. :EXAMPLE (NEXT) 15 NEXT I 2 ONERROR ONERROR GOTO line number ONERROR GO BACK The ONERROR GOTO statement allows the program to transfer control to an err-handling routine. The ONERROR GO BACK statement allows a subprogram containing an error to return to the program that called it for error handling. :EXAMPLE (ONERROR (ON ERROR)) 25 ONERROR GOTO 50 30 ON ERROR GO BACK 2 ON_GOSUB ON num exp GOSUB line number(s) The ON GOSUB statement is used to conditionally transfer control to one of several subroutines or to one of several entry points into one or more subroutines. :EXAMPLE (ON GOSUB) 50 ON A+B GOSUB 80, 95, 100 2 ON_GOTO ON num exp GOTO line number(s) THEN The ON GOTO statement allows the program to transfer control to one of several different places in the program depending on the value of num exp. :EXAMPLE (ON GOTO) 20 ON J% GOTO 85, 90, 95, 100 2 ON_THEN See ONGOTO :EXAMPLE (ON THEN) 2 OPEN OPEN filename exp [FOR INPUT ] AS FILE [#] expression OUTPUT SEQUENTIAL FIXED ,[ORGANIZATION] RELATIVE [VARIABLE] INDEXED STREAM UNDEFINED VIRTUAL READ NONE [,ACCESS WRITE [ALLOW READ ]] MODIFY WRITE SCRATCH MODIFY APPEND [,MAP mapname ] MODE ,RECORDSIZE num exp [,BLOCKSIZE num exp [,FILESIZE num exp] [,SPAN ] [,CONTIGUOUS] [,TEMPORARY] NOSPAN [,BUCKETSIZE num exp [,CONNECT] [,CLUSTERSIZE num exp [,BUFFER] WINDOWSIZE [,PRIMARY [KEY]name DUPLICATES NODUPLICATES NOCHANGES] [,ALTERNATE [KEY]name DUPLICATES CHANGES NODUPLICATES NOCHANGES] The OPEN statement enables you to create a new file or access an existing file. You can use the OPEN statement to access terminal-format virtual, or record files. :EXAMPLES (OPEN) 10 OPEN "FIL4.DAT" FOR INPUT AS FILE #4% 2 PRINT PRINT [expression(s)] The PRINT statement causes the data you specify to be output on the terminal. The expression list can be expressions, variables, or quoted strings separated by a xomma or a semicolon. Commas cause output to terminal print zones; semicolons supress spacing between elements. :EXAMPLE (PRINT) 30 PRINT A+B 2 PRINT_# PRINT # expression, list The PRINT # statement writes data into the specified terminal-format file. :EXAMPLE (PRINT #) 65 PRINT # 6%, A, B+C 2 PRINT_USING PRINT [# expression] USING string, list The PRINT USING statement causes output to be printed in a specified format. The optional expression indicates the channel number of the file in which to print the list. :EXAMPLE (PRINT USING) 10 PRINT USING "**##.##", A,B,C 2 PUT PUT # num exp [,RECORD num exp] [,COUNT num exp] The PUT statement writes a record from a fubber to a specified file. The RECORD caluse is used for relative or Block I/O files. Sequential files allow PUT operations only at the end of the file. The COUNT clause can redefine the size of the record. :EXAMPLE (PUT) 25 PUT #7%, RECORD 15% 2 RANDOMIZE RANDOMIZE The RANDOMIZE statement changes the starting point of the RND function to a new unpredictable location. :EXAMPLE (RANDOM[IZE]) 10 RANDOMIZE 2 READ READ variable(s) The READ statement directs BASIC to read from a list of values built into a data b;pcl bu a DATA statement. :EXAMPLE (READ) 75 READ A,B%,C$, D(5) 2 REM REM comment The REM statement contains user written comments and has no effect on program execution. :EXAMPLE (REM) 30 REM this is a comment 2 RESTORE RESTORE # num exp[,KEY#num exp] The RESTORE# statement with the KEY clause resets an indexed file to the beginning of the key specified. The RESTORE # statement without the KEY clause resets the specified file to the first record in the file. RESTORE without a file expression restores the data in a DATA statement. :EXAMPLE (RESTORE #) 30 RESTORE #3 2 RESUME RESUME [line number] The RESUME statement is the last statement in an error-handling subroutine. If no line number is specified, control is shifted back to the point of error generation. If a line number is specified, control is shifted to that line. :EXAMPLE (RESUME) 50 RESUME 35 2 RETURN RETURN The RETURN statement is the last statement in a subroutine. It shifts control to the statement following the last executed GOSUB statement. :EXAMPLE (RETURN) 60 RETURN 2 RSET RSET string variable(s) = string expression The RSET statement assigns nnew values to string variables. The new data is right justified and the length is unchanged. :EXAMPLE (RSET) 10 RSET A$,B$,=X$+Y$ 2 SCRATCH SCRATCH #file exp The SCRATCH statement allows you to truncate a sequential file. SCRATCH can only be used if the file was OPENed with ACCESS SCRATCH. :EXAMPLE (SCRATCH) 25 SCRATCH #6 2 STOP STOP The STOP statement causes a halt in program execution. Files are not closed and a message indicating the location of the halt is printed. :EXAMPLE (STOP) 110 STOP 2 SUB SUB name [(dummy argument(s))] The SUB statement marks the beginning of a subprogram and defines the type and number of subprogram parameters. :EXAMPLE (SUB) 40 SUB TEST (A,B%) 2 SUBEND The SUBEND statement marks the end of the subprogram and returns control to the calling program. It must appear at the end of all subprograms. :EXAMPLE (SUBEND) 25 SUBEND 2 SUBEXIT SUBEXIT The SUBEXIT statement is equivalent to a GOTO, where the destination is the SUBEND statement in the current subprogram. SUBEXIT is legal only in a subprogram. :EXAMPLE (SUBEXIT) 899 SUBEXIT 2 UNTIL UNTIL conditional exp The UNTIL statement sets up a loop that must have a corresponding NEXT statement. The loop executes until the expression is true. :EXAMPLE (UNTIL) 50 UNTIL I=0 2 UPDATE UPDATE # num exp [,COUNT exp] The UPDATE statement changes an existing record in the file. On sequential files the new record size as defined in the MAP or COUNT clause, must be the same as the record it replaces. An UPDATE must be preceded by a successful GET or FIND. :EXAMPLE (UPDATE) 50 UPDATE #1 2 WHILE WHILE conditional exp The WHILE statement sets up a loop that must have a NEXT statement. The conditional expression is evaluated before each loop iteration. If the expression is true, BASIC executes the statements in the loop If the expression is false, BASIC executes the statements following the NEXT statement. :EXAMPLE (WHILE) 75 WHILE A%<10% 2 ABS ABS(x) The ABS(x) function returns the absolute value of x. :EXAMPLE (ABS(x)) 2 ASCII ASCII(x$) The ASCII(x$) function returns the decimal ASCII value of the first character of a specified string. :EXAMPLE (ASCII) 2 ATN ATN(x) The ATN(x) function returns the arctangent of x in radians. :EXAMPLE (ATN(x)) 2 BUFSIZ BUFSIZ(n%) The BUFSIZ function in certain applications, it is important for a program to determine the buffer size of an open channel, particularly if the OPEN statement specifies a logical device name. Your program can execute the integer function BUFSIZ to extract this information. The BUFSIZ function returns an integer value, which is the size of the buffer in bytes. If the chan is closed, BUFSIZ equals 0. :EXAMPLE (BUFSIZ(n%)) the format of the BUFSIZ function is: BUFSIZ(N%) where N% equals the channel number. 2 CCPOS CCPOS(n%) The CCPOS function returns the current position on the output line for the given channel number. The format of the CCPOS function is: CCPOS(N%) where N% is the I/O channel number. N% may range from 0 to 14. CCPOS(0%) returns the position for your terminal. :EXAMPLE (CCPOS) 2 CHR$ CHR$(x%) The CHR$(x%) function returns the character equivalent of the ASCII value x%. :EXAMPLE (CHR$(x%) 2 COMP% COMP%(x$,y$) This COMP%(x$,y$) functions returns the following: Value Relationship of x$ to y$ 1 greater than 0 equal to -1 less than :EXAMPLE (COMP%(x$,y$)) 2 COS COS(s) The COS(s) functions returns the cosine of x. :EXAMPLE (COS(s)) 2 CTRLC The CTRLC enables CTRL/C trapping/ :EXAMPLE (CTRLC) 2 CVT$ See EDIT$. :EXAMPLE (CVT) 2 DATE$ DATE$(x%) The DATE$(x%) function returns the date in the form dd-mm-yy according to the formula. :EXAMPLE (DATE$(x%)) x% = 1000 * (years since 1970) + (Julian day of the year) 2 DET DET The DET function returns the determinant of a matrix. :EXAMPLE (DET) 2 DIF$ DIF$(x$,y$) The DIF$(X$,Y$) function subtracts y$ from x$ and returns the difference. :EXAMPLE (DIF$(x$,y$) 2 ECHO ECHO(n%) The ECHO enables terminal echo of characters sent to the system from your terminal. :EXAMPLE (ECHO(n%)) ECHNO (2%) 2 EDIT$ EDIT$(string,n%) The EDIT$ converts the string to the integer specified in the table in Section 7.3.8 of the Language Manual. :EXAMPLE (EDIT$(string,n%)) EDIT$ (string,2%) 2 ERL The ERL function returns the line number on which an error occurred. :EXAMPLE (ERL) 2 ERN$ The ERN$ function returns the name of the subprogram in which an error occurred. :EXAMPLE (ERN$) 2 ERR The ERR function returns the error code (see Appendix E). :EXAMPLE (ERR) 2 ERT$ ERT$(n%) The ERT$ function returns the text error message associated with a given value of N%. N% equals the error code for the current error. (See Appendix E.) :EXAMPLE (ERT$(n%)) ERT$(3%) 2 EXP EXP(x) The EXP function returns the value of ex where e = 2.71828, the base of natural logarithms. :EXAMPLE (EXP(x)) 2 FIX FIX(x) The FIX function returns the value of x truncated to an integer. :EXAMPLE (FIX(x)) 2 FORMAT$ FORMAT$(B$,A) (A,B$) The FORMAT$ function returns the numeric variable formatted according to the contents of the associated string. The formatting rules are the same as for PRINT USING. :EXAMPLE (FORMAT$) 2 FSP$ FSP$(N%) The FSP$ function returns the string that describes the file that is open on a given channel. N% is the channel number. :EXAMPLE (FSP$) FSP$(2%) 2 FSS$ FSS$(A$,B%) The FSS$ function performs a filename string scan on A$ starting at position B%. :EXAMPLE (FSS$) 2 INSTR INSTR(z%,x$,y$) The INSTR function returns the position of substring y$ in the main string x$ starting at position z%. :EXAMPLE (INSTR) 2 INT INT(x) The INT function returns the integral part of x. (INT(x) returns the same value as FIX(x) for equal values of x, but INT(x) does not change x.) :EXAMPLE (INT) 2 LEFT LEFT$(x$,y$) The LEFT$ function returns a substring of x$ beginning at the leftmost position for a total length of y% characters. :EXAMPLE (LEFT$) 2 LEN LEN(x$) The LEN function returns the number of characters in x$. :EXAMPLE (LEN) 2 LOT LOG(x) The LOG function returns the natural logarithm of x. In the following formula. :EXAMPLE (LOG) ex = y then in y = log(e) y = x 2 LOG10 LOG10(x) The LOG10 function returns the common logarithm of x. Common logarithms differ from natural logarithms in that the base of common logarithms is 10, as opposed to 2.71828 for natural logarithms. :EXAMPLE (LOG10) 2 MID$ MID$(string, n1%,n2%) The MID$ function returns a substring n2% characters long starting at position n1% of string. :EXAMPLE (MID$) MID$(string,1%,2%) 2 NOECHO NOECHO(N%) The NOECHO function disables terminal echo. :EXAMPLE (NOECHO) NOECHO(3%) 2 NUM$ NUM$(n%) The NUM$ function returns n% as PRINT would write it. :EXAMPLE (NUM$) NUM$(5%) 2 NUM2 NUM2 The NUM2 function is the number of eleements in the last column of a matrix. :EXAMPLE (NUM2) 2 NUM1$ NUM1$(n%) The NUM1$ function returns n% as PRINT would write it, but without spaces or E format. :EXAMPLE (NUM1$) NUM1$(5%) 2 PI PI The PI function returns a constant value: 3.14159. :EXAMPLE (PI) 2 PLACE PLACE$(x$,n%) The PLACE$ function returns x$ with precision according to n%. :EXAMPLE (PLACE$) PLACE$(x$,3%) 2 POS POS(x$,y$,z%) The POS function returns the position of substring y$ in that portion of the main string x$ that extends from position z% to the end of the main string. See also INSTR. :EXAMPLE (POS) 2 PROD$ PROD$(x$,y$,n%) The PROD$ function returns the product of x$ and y$ with precision according to n%. :EXAMPLE (PROD$) PROD$(x$,y$,2%) 2 QUO$ QUO$(x$,y$,n%) The QUO$ function divides x$ by y$ and returns the quotient with precision according to n%. :EXAMPLE (QUO$) QUO$(x$,y$,2%) 2 RAD$ RAD$(x%) The RAD$ function converts the integer x% to its RADIX-50 equivalent. :EXAMPLE (RAD$) 2 RCTRLC RCTRLC The RCTRLC function disables CTRL/C trapping. :EXAMPLE (RCTRLC) 2 RCTRL0 RCTRLO(N%) The RCTRLO function cancels the effect of typing CTRL/O on channel n%. See your system of user's guide for a description of the effect of CTRL/O on your system. :EXAMPLE (RCTRLO) RCTRLO(7%) 2 RECOUNT The RECOUNT function a GET or INPUT operation can transfer a variable number of bytes of data. This occurs when you redoing input from a device such as a terminal or magtape or from a file with variable records. The system variable RECOUNT allows you to determine how much data was actually read. RECOUNT contains the number of characters read after each input operation. RECOUNT is set by every input operation on any channel, including channel 0 (your terminal). For this reason, if you need to know the value of RECOUNT for testing, you should copy it immediately after you execute a GET statement. Note that if an error occurs during the GET operation, RECOUNT is not properly set. :EXAMPLE (RECOUNT) 2 RIGHT RIGHT$(x$,y%) The RIGHT$ function returns a substring of x$ that extends from the yth character to the end of the string. :EXAMPLE (RIGHT$) 2 RND RND The RND function returns a real random number between 0 and 1. :EXAMPLE (RND) 2 SEG$ SEG$(x$,y%,z%) The SEG$ function returns the substring of x$ that extend from the yth character to the zth character (compare with RIGHT). :EXAMPLE (SEG$) 2 SGN SGN(x) The SGN function returns: if x is: :EXAMPLE (SGN) 1 positive 0 zero -1 negative 2 SIN SIN(x) The SIN function returns the sine of x in radians. :EXAMPLE (SIN) 2 SPACE SPACE$(x) The SPACE$ function produces and returns a string of x spaces. :EXAMPLE (SPACE$) 2 SQR SQR(x) The SQR function returns the square root of x; also SQRT(x). :EXAMPLE (SQR) 2 STATUS STATUS The variable STATUS contains information about the last channel on which your program executed an OPEN statement. STATUS is a 16-bit word. Your program can test each bit to determine the status of the channel. See your User's Guide to determine the interpretation of each bit. :EXAMPLE (STATUS) 2 STR$ STR$(x) The STR$ function returns the value of an expression without the leading and trailing blanks (see also NUM$(x)). :EXAMPLE (STR$) 2 STRING$ STRING$(x%,y%) The STRING$ function creates and returns a string x% characters long that represents the ASCII value of y%. (See also ASCII.) :EXAMPLE (STRING$) 2 SUM$ SUM$(x$,y$) The SUM$ function returns the sum of x$ and y$. :EXAMPLE (SUM$) 2 TAB TAB(x) The TAB function moves the print head to the xth position. :EXAMPLE (TAB) 2 TAN TAN(x) The TAN function returns the tangent of x in radians. :EXAMPLE (TAN) 2 TIME TIME(0) The TIME function returns the clock time in seconds since midnight. :EXAMPLE (TIME) 2 VAL VAL(x$) The VAL function computes the numric value of the numeric string x$, x$ must be acceptable numeric input. :EXAMPLE (VAL) 2 XLATE XLATE(A$,B$) The XLATE function translates a string to another using a translation table, B$. :EXAMPLE (XLATE)