HELP may be obtained using the following keywords: COMMANDS - List of commands to BASIC-PLUS-2 compiler CONSTANT - Format of BASIC-PLUS-2 constants DEBUG - Help on the BASIC-PLUS-2 debugger FUNCTIONS - List of BASIC-PLUS-2 functions OPERATORS - Legal BASIC-PLUS-2 operators STATEMENTS - List of BASIC-PLUS-2 statements VARIABLES - Format and range of BASIC-PLUS-2 variables - Help on each individual command - Help on each individual function - Help on each individual statement To obtain this information type HELP BP2 2 COMMANDS The following is a brief list of available complier commands. For more help type HELP BP2 'command'. APPEND BUILD COMPILE DELETE EXIT IDENTIFY LIBRARY LIST LOCK NEW OLD RENAME REPLACE RUN SAVE SCALE SHOW UNSAVE 2 CONSTANT BASIC-PLUS-2 accepts three types of constants: floating-point, string, and integer. Floating-point constants are numbers in the range of 10E38 3 BREAK The BREAK command sets a breakpoint at one or more specified positions in the program such that execution of the program will be halted at the specified point and control returned to the Debugger. There are seven forms of the BREAK command:- #BREAK - Set a breakpoint at each program line #BREAK n - Set a breakpoint for all occurrences of line number n #BREAK n; - Set a breakpoint for line n in the currently executing program or subprogram #BREAK n;name - Set a breakpoint for line n in the named program or subprogram #BREAK ON CALL - Set a breakpoint on each occurrence of the statement CALL. The breakpoint occurs before the first statement of the subprogram. #BREAK ON DEF - Set a breakpoint for each time the program executes a user-defined function. The breakpoint occurs before the execution of the function. #BREAK ON LOOP - Set a breakpoint for each occurrence of the statements FOR, WHILE and UNTIL. Breakpoints occur before the loop is initialized, immediately before execution of the loop body, and after exit from the loop. For example, if you have a FOR loop that executes 10 times you will get 13 breaks. 3 CONTINUE The CONTINUE statement continues execution after a breakpoint. It should be used to initialize a TRACE of the program. 3 ERL If ERL is typed in response to a debugger prompt, the the line number of the last trapped error will be printed. If no error has occurred the output will be meaningless. 3 ERN$ If ERN$ is typed in response to a debugger prompt, the name of the module that contained the last trapped error will be printed. If no error has occurred the output will be meaningless. 3 ERR If ERR is typed in response to a debugger prompt, the error number of the last trapped error will be printed. If no error has occurred the output will be meaningless. 3 LET The LET command command allows you to change the contents of variables in programs and subprograms. The LET statement allows constants or variables as arguments, but not expressions, and has a maximum length of 72 characters. Examples are:- #LET A$(I,J%) = B$(Q%,Z) #LET I% = A(I%,I%) 3 PRINT The PRINT command command allows you to print the contents of variables in programs and subprograms. The PRINT statement allows constants or variables as arguments, but not expressions, and has a maximum length of 72 characters. Examples are:- #PRINT A$(I,J%) #PRINT I% 3 RECOUNT If the command RECOUNT is typed in response to the debugger prompt, it will display the number of characters that were typed in response to the last INPUT statement. 3 STATUS If the command STATUS is typed in response to the debugger prompt, it will display the status word containing characteristics of the last OPENed file, where the value given is an additive form of:- 1 - Record-oriented device 2 - Carriage-control device 4 - Terminal 8 - Multiple-directory device (disk) 16 - Single-directory device 32 - Sequential and block-oriented device (magnetic tape) 3 STEP The STEP command causes program execution to continue on a statement by statement basis. The format of the command is:- #STEP where n, if specified, is a positive integer in the range 1 to 32767 which specifies the number of statements to execute before halting again. If n it omitted a value of 1 is assumed. This command should not be used after a TRACE command. 3 TRACE The TRACE command instructs the debugger to print the module name and statement number for every statement it executes. The TRACE command should be followed by a CONTINUE command (not a STEP command) and the program will then execute, listing names and line numbers, until a breakpoint is detected. 3 UNBREAK The UNBREAK command reverses the action of the BREAK command and removes breakpoints previously set. It has seven forms, each of which removes the breakpoints set by the corresponding BREAK command:- #UNBREAK #UNBREAK n #UNBREAK n; #UNBREAK n;name #UNBREAK ON CALL #UNBREAK ON DEF #UNBREAK ON LOOP For more information type HELP BP2 DEBUG BREAK 3 UNTRACE The UNTRACE command switches off the trace output enabled by the TRACE command. For more information type HELP BP2 DEBUG TRACE. 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 LOG LOG10 MID$ NOECHO NUM(2) NUM$ NUM2 NUM1$ PI PLACE POS PROD$ QUO$ RAD$ RCTRLC RCTRLO RECOUNT RIGHT RND SEG$ SGN SIN SPACE$ SQR STATUS STR$ STRING$ SUM$ TAB TAN TIME VAL XLATE 2 OPERATORS The following are valid operators under BASIC-PLUS-2:- Operator Use Meaning ^ or ** A^B Exponentiation * A*B Multiplication / A/B Division + A+B Addition, unary plus or string concatenation - A-B Subtraction or unary minus NOT NOT A Logical negative of A AND A AND B Logical product of A and B OR A OR B Logical sum of A and B XOR A XOR B Logical exclusive or of A and B EQV A EQV B A is logically equivalent to B IMP A IMP B Logical implication of A and B = A=B A is equal to B < A A>B A is greater than B <= or =< A<=B A is less than or equal to B >= or => A=>B A is greater than or equal to B <> or >< A<>B A is not equal to B == A==B A is approximately equal to B (for numbers the difference is less than 10^-6; for strings they are equal in length and composition) 2 STATEMENTS The following is a list of BP2 statements. For more help type HELP BP2 'statement'. CALL CHAIN CHANGE CLOSE COMMON DATA DEF DELETE DIM END FIND FNEND FNEXIT FOR GET GOSUB GOTO IF INPUT KILL LET LINPUT LSET MAP MAT_INPUT MAT_ PRINT MAT_READ MOVE NAME NEXT 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 VARIABLES BASIC-PLUS-2 accepts three types of variables: floating-point, string, and integer. Floating-point variables consist of a single letter followed by up to 29 optional letters, digits, and periods. Integer variables also consist of a single letter optionally followed by up to 29 letters, digits, and periods and terminated by a percent sign. If a percent sign is not specified, the variable is considered floating-point. String variables consist of a single letter optionally followed by up to 29 letters, digits and periods and terminated by a dollar sign. You can use any alphanumeric combination for a variable name with the exception of keywords (that is, words that are part of the BASIC language). Keywords are reserved and their use as variable names will produce an error during compilation. You designate an array by specifying a floating-point, integer, or string variable followed by subscripts in parentheses. Subscripts are in the range of 0 to 32767 and a maximum of two can be specified. One subscript indicates a 1-dimensional array; two subscripts separated by commas indicate a 2-dimensional array. Subscripts can be integers or expressions, but non-integer subscripts are truncated to an integer value. Variables are initialized to 0 or a null string at the start of program execution. However, it is recommended that you explicitly initialize all program variables as desired. Note that variables in COMMON, MAP statements, and virtual arrays are not zeroed. 2 APPEND APPEND filespec Merges a previously saved source program (filespec) with one in memory. :EXAMPLE (APPEND) OLD FOO APPEND BOO Images from BOO are copied into the BASIC work area and appended following those from FOO. 2 BUILD Syntax: BUILD filespec/sw Produces a command file from specified object modules. This file contains all of the task builder command input required to create a task image and memory allocation map. :Example (BUILD) OLD FOO COMPILE BUILD FOO/SEQ 2 COMPILE COMPILE filespec/sw Compiles the current program. This command can be combined with certain switches. If a file name is specified, the program is compiled under that name. :EXAMPLE (COMPILE) OLD FOO COMPILE FOO/DEBUG 2 DELETE DELETE # num exp The DELETE operation is used on relative and indexed files only. The operation erases an existing record from the file. :EXAMPLE (DELETE) 60 DELETE #5% 2 EXIT EXIT Terminates access to the BASIC-PLUS-2 Compiler and returns you to MCR. :EXAMPLE (EXIT) EXIT 2 IDENTIFY IDENTIFY Prints a header that identifies the BASIC-PLUS-2 Compiler. :EXAMPLE (IDENTIFY) IDENTIFY 2 LIBRARY LIBRARY Allows you to link to a user-specified resident library. Once entered the statement prompts for further information. :EXAMPLE (LIBRARY) LIBRARY Name [BASIC2] -- Account [LB:[1,1]] -- 2 LIST LIST [NH] line number(s) Prints a copy of all or part of the current program. :EXAMPLE (LIST) LIST 100-200 2 LOCK LOCK/sw Sets BUILD and COMPILE switch specifications as defaults. :EXAMPLE (LOCK) LOCK/SEQ 2 NEW NEW filename Clears your directory area for the creation of a program. If you specify a file name, the new program is assigned that name. :EXAMPLE (NEW) NEW BOO 2 OLD OLD filename Brings a program from disk into memory. :EXAMPLE (OLD) OLD FOO 2 RENAME RENAME filename Changes the name of the current program to the specified name. :EXAMPLE (RENAME) RENAME NEWPRO 2 REPLACE REPLACE filespec Saves the current program by overriding any file with that name. :EXAMPLE (REPLACE) REPLACE MYPRO 2 RUN BP2 programs must be taskbuilt before being run. 2 SAVE SAVE filespec Stores the current program as source code. The program is saved under the current name unless another is specified. :EXAMPLE (SAVE) SAVE MYPRO 2 SCALE SCALE val Sets the scale factor to a designated value or prints the current value if none is specified. The range of val is 0 to 6. :EXAMPLE (SCALE) SCALE 4 2 SHOW SHOW Prints the current switch values on the terminal. :EXAMPLE (SHOW) SHOW 2 UNSAVE UNSAVE filespec Deletes a specified file. :EXAMPLE (UNSAVE) UNSAVE OLDPRO 2 CALL CALL name [(actual arguments)] The CALL statement transfers control to a specified subprogram, transfers parameters, and saves the state of the calling program. Parameters contained in the argument list must agree in type and number with the corresponding SUB statement. :EXAMPLE (CALL) 200 CALL SUB1 (A,B) 2 CHAIN CHAIN string The CHAIN statement passes control to a specified program. It does so via the REQST directive. No line number information may be specified. :EXAMPLE (CHAIN) 15 CHAIN "SEE" 2 CHANGE CHANGE list TO string variable or CHANGE string expression TO list The CHANGE statement converts a list of integers (real numbers are truncated) into a string of characters and vice versa. The length of the string is determined by the value found in element 0 of the list. :EXAMPLE (CHANGE) 25 CHANGE A TO A$ 2 CLOSE CLOSE [#] expression(s) The CLOSE statement terminates I/O to a device and writes all active buffers. The number sign is optional. 2 COMMON COM [(NAME)] list The COM, or COMMON statement allows you to establish a named storage area that can be shared by 2 or more subprograms. The common area name must be 1 to 6 characters. :EXAMPLE (COM) 50 COM (TEST) A,B,C 2 DATA DATA constant(s) The DATA statement allows you to provide a pool of information that is accessible to the program by means of a READ statement. A DATA statement must be the only statement on the line and, when you specify more than one item, you must separate them with commas. DATA statements cannot have comments. :EXAMPLE (DATA) 50 DATA 4.3, "ABC", 18, 42 2 DEF DEF FNa [(b1,b2,b3,...b8)]=expression ! Single-line form or DEF FNa [(b1,b2,b3,...b8)] ! Multiple-line form statements... ! FNEND ! A DEF statement establishes a user-defined function. A function name can be any legal variable name and must begin with FN. The variable type determines the function type. The optional arguments represent dummy parameters and cannot contain array elements. A function definition can refer to any of the dummy parameters or to other program variables but the definition cannot be recursive. Single-line user-defined functions are local to the main program or subprogram in which they are contained. The multi-line DEF establishes user-defined functions and allows you to include other statements in the body of the function. The function name can be any variable name preceded by FN. Any statement can appear in a function except SUB, SUBEND, RETURN or another DEF. The DATA and DIM statements are not local to the function definition. A GOTO, GOSUB, ONGOTO, or ONGOSUB transfer outside the function is not allowed. The function definition must end with an FNEND statement. :EXAMPLE (DEF) 10 DEF FNTIMES2(X) = X*2 20 DEF TIMES4(Y) 21 X4 = Y+Y+Y+Y 22 PRINT "FNTIMES4: RESULT IS", X4 23 FNTIMES4 = X4 24 FNEND 2 DELETE DELETE #filename expression The DELETE statement erase an existing record from a relative or indexed file. You must execute a successful FIND or GET statement before you can issue a DELETE statement. Because that FIND or GET operation points to the record, you do not have to specify it in the DELETE statement. :EXAMPLE (DELETE) DELETE #1 2 DIM DIM subscripted variable(s) ! Array dimensions or DIM #expression, array(s) [=integer] ! Virtual Array dimensions A DIM statement can be used to reserve space for arrays. The amount of storage reserved is determined by the product of the (constant) sub- script limits. A maximum of two subscripts is permitted. When two sub- scripts are used, they must be separated by a comma. A DIM statement may also be used to reserve space for arrays on the file whose logical unit number is referenced (follows the "#"). Space is allocated at the beginning of the file such that the rightmost subscript varies fastest. The default string storage length is 16 bytes and the space is preallocated. :EXAMPLE (DIM) 30 DIM EMPLOYEE.NUMBERS(100) ! Space for 101 employees 50 DIM #2, ARRAY.1(10,15),ARRAY.2(6) ! This is a VIRTUAL ARRAY 2 END END The END statement terminates program execution and closes all files. END must be the last statement in the program. :EXAMPLE (END) 100 END 2 FIND FIND # num exp [,RECORD num exp] GT [,KEY #num exp GE string exp] EQ The FIND operation causes a RECORD search in the specified file. For sequential files, the FIND starts at the beginning of the file and locates each successor record for each FIND operation. Relative files allow the specification of a record number. Indexed files allow the specification of a key or a sequential search through the key table. The RECORD and KEY specifications are restricted to relative and indexed files, respectively. :EXAMPLE (FIND) 50 FIND #7%, RECORD 25 2 FNEND FNEND The FNEND statement causes an exit from a user-defined function and signals the function's logical and physical end. :EXAMPLE (FNEND) 40 FNEND 2 FNEXIT FNEXIT The FNEXIT statement is equivalent to a GOTO, where the destination is the FNEND statement for the current multi-line DEF. FNEXIT is legal only inside a multi-line DEF. :EXAMPLE (FNEXIT) 70 FNEXIT 2 FOR FOR variable=num exp1 TO num exp2 [STEP num exp3] The FOR statement initiates and controls a loop. A simple numeric variable must be used after the FOR, and the same variable must appear in the required NEXT statement. The first numeric expression is the initial loop value; the second expression is the terminating loop value. The optional STEP expression is the loop increment; +1 is the default. Transfer into an uninitialized loop is illegal. :EXAMPLE (FOR) 25 FOR I=1 TO 5 STEP 2 FOR variable=num exp1 [STEP num exp2] WHILE conditional UNTIL exp The conditional FOR statement duplicates the previous FOR statement except that loop termination is determined by a false expression in the WHILE clause or a true expression in the UNTIL clause. :EXAMPLE (FOR (conditional)) 80 FOR I=1 UNTIL I>10 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 LINPUT 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$ 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_INPUT MAT INPUT array(s) The MAT INPUT statement reads the values into elements of a 1- or 2-dimensional array from the terminal. :EXAMPLE (MAT INPUT) 50 MAT INPUT 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 NEXT 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 LOG10 LOG(x) The LOG function returns the natural logarithm of x. In the following formula. :EXAMPLE (LOG) e^x = y then in y = log(e) y = x 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. 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 NUM The NUM function is the number of colums you enter in a matrix. :EXAMPLE (NUM) NUM NUM2 The NUM2 function is the number of eleements in the last column of a matrix. :EXAMPLE (NUM2) 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)