-*-TAGS-*- File: Second, Node: Functions, Up: (basic)Top, Prev: (Basic)Statements, Next: Error Messages * Menu: * Mathematical Functions:: * Print Functions:: * String Functions:: * System Functions:: * Matrix Functions:: * Magtape Functions:: FORMAT OF FUNCTIONS Under the function column, the function is shown as: Y=function where the characters % and $ are appended to Y if the value returned is an integer or character string. A floating value (X), where specified, can always be replaced by an integer value. An integer value (N%) can always be replaced by a floating value (an implied FIX is done) except in the CVT%$ and MAGTAPE functions (the symbol I% is used to indicate the necessity for an integer value).  File: Second, Node: Mathematical Functions, Up: Functions, Next: Print Functions Function Explanation Y=SIN(X) returns the sine of X in radians Y=COS(X) returns the cosine of X in radians. Y=TAN(X) returns the tangent of X in radians Y=ATN(X) returns the arctangent of X in radians. Y=EXP(X) returns the value of e^X, where e= 2.71828. Y=LOG(X) returns the natural logarithm of X, logeX. Y=LOG10(X) returns the common logarithm of X, log10X Y=PI has a constant value of 3.14159 Y=SQR(X) returns the square root of X Y=ABS(X) returns the absolute value of X Y=RND returns a random number between 0 and 1 Y=RND(X) returns a random number between 0 and 1 Y=FIX(X) returns the truncated value of X, SGN(X)*INT(ABS(X)) Y=INT(X) returns the greatest integer in X which is less than or equal to X Y=SGN(X) returns the sign function of X, a value of 1 preceded by the sign of X  File: Second, Node: Print Functions, Up: Functions, Prev: Mathematical Functions, Next: String Functions Y%=POS(X%) returns the current position of the print Y%=CCPOS(X%) head for I/O channel X, 0 is the user's terminal. Y$=TAB(X%) moves print head to position X in the current print record, or is disregarded if the current position is beyond X. (The first position is counted as 0.)  File: Second, Node: String Functions, Up: Functions, Prev: Print Functions, Next: System Functions Y%=ASCII(A$) returns the ASCII value of the first character in the string A$. Y$=CHR$(X%) returns a character string having the ASCII value of X. Only one character is generated. Y$=CVT%$(I%) maps integer into 2-character string, see Section 11.5. Y$=CVTF$(X) maps floating-point number into 4- or 8- character string, see Section 11.5. Y$=CVT$%(A$) maps first 2 characters of string A$ into an integer, see Section 11.5. Y=CVT$F(A$) maps first 4 or 8 characters of string A$ into a floating-point number. See Section 11.5. Y$ = CVT$$(A$,I%) converts string A$ to string Y$ accord- ing to value of I%. See Section 11.5. _______________________________________________________ | | |Summary of Decimal Values for I% in the CVT$$ Function | | | | 1% Trim the parity bit. | | 2% Discard all spaces and tabs. | | 4% Discard excess characters: | | CR, LF, FF, ESC, RUBOUT, and NUL. | | 8% Discard leading spaces and tabs. | | 16% Reduce spaces and tabs to one space. | | 32% Convert lower case to upper case. | | 64% Convert [ to ( and ] to ). | | 128% Discard trailing spaces and tabs. | | 256% Do not alter characters inside quotes. | |_______________________________________________________| Y$ = STRING$(N1,N2) creates string Y$ of length N1 and characters whose ASCII decimal value is N2. See Section 4.5. Y$=LEFT(A$,N%) returns a substring of the string A$ from the first character to the Nth character (the leftmost N characters). Y$=RIGHT(A$,N%) returns a substring of the string A$ from the Nth to the last character; the rightmost characters of the string starting with the Nth character. Y$=MID(A$,N1%,N2%) returns a substring of the string A$ starting with the N1 and being N2 characters long (the characters between and including the N1 to N1+N2-1 characters). Y%=LEN(A$) returns the number of characters in the string A$, including trailing blanks. Y%=INSTR(N1%,A$,B$) indicates a search for the substring B$ within the string A$ beginning at character position N1. Returns a value 0 if B$ is not in A$, and the character position of B$ if B$ is found to be in A$ (character posi- tion is measured from the start of the string). Y$=SPACE$(N%) indicates a string of N spaces, used to insert spaces within a character string. Y$=NUM$(N%) indicates a string of numeric characters representing the value of N as it would be output by a PRINT statement For example: NUM$(1.0000) = (space)1(space) and NUM$(-1.0000) = -1(space). Y=VAL(A$) computes the numeric value of the string of numeric characters A$. If A$ contains any character not acceptable as numeric input with the INPUT statement, an error re- sults. For example: VAL("15")=15 Y$=XLATE(A$,B$)D translate A$ to the new string Y$ by means of the table string B$, see Section 11.7.  File: Second, Node: System Functions, Up: Functions, Prev: String Functions, Next: Matrix Functions Y$=DATE$(0%) returns the current date in the fol- lowing format: 02-Mar-81 Y$=DATE$(N%) returns a character string corresponding to a calendar date as follows: N=(day of year)+[(number of years since 1970)*1000] DATE$(1) = "01-Jan-70" DATE$(125) = "05-May-70" Y$=TIME$(0%) returns the current time of day as a character string as follows: TIME$(0)="05:30 PM" or "17:30 PM" Y$=TIME$(N%) returns a string corresponding to the time at N minutes before midnight, for example: TIME$(1) = "11:59 PM" or 23:59 TIME$(1440)= "12:00 AM" or 00:00 TIME$(721) = "11:59 AM" or 11:59 Y=TIME(0%) returns the clock time in seconds since midnight, as a floating point number. Y=TIME(1%) returns the central processor time used by the current job in tenths of seconds. Y=TIME(2%) returns the connect time (during which the user is logged into the system) for the current job in minutes. Y=TIME(3%) returns to Y the decimal number of kilo-core ticks (kct's) used by this job. See Section 7.8. Y=TIME(4%) returns to Y the decimal number of minutes of device time used by this job. See Section 7.8 Y%=STATUS returns to Y% the status of the most recently OPENED statement executed in the program. See Section 11.3.8. Y%=BUFSIZ(N) returns to Y% the buffer size of the device or file open on channel N. see Section 11.3.7. Y%=LINE returns to Y% the ln of the statement being executed at the time of an interrupt. See Section 3.2. Y%=ERR returns value associated with the last encountered error if an ON ERROR GOTO statement appears in the pro- gram. See Section 7.4. Y%=ERL returns the ln at which the last error occured if an ON ERROR GOTO statement appears in the pro- gram. See Section 7.4.3. Y%=SWAP%(N%) causes a byte swap operation on the two bytes in the integer variable N%. Y$=RAD$(N%) converts an integer value to a 3- character string and is used to convert from Radix-50 format back to ASCII. See Appendix D.  File: Second, Node: Matrix Functions, Up: Functions, Prev: System functions, Next: Magtape Functions Function Explanation Matrix MAT Y=TRN(X) returns the transpose of the matrix X, see Section 6.6.2. MAT Y=INV(X) returns the inverse of the matrix X, see Section 6.6.2. Y=DET following an INV(X) function evalua- tion, the variable DET is equiva- lent to the determinant of X. Y%=NUM following input of a matrix, NUM contains the number of rows input, or in the case of a one dimensional matrix, the number of elements entered. Y%=NUM2 following input of a matrix, NUM2 contains the number of elements entered in that row.  File: Second, Node: Magtape Functions, Up: Functions, Prev: Matrix Functions Input/Output Y%=RECOUNT returns the number of characters read following every input operation. used primarily with non-file structured devices. See Section 11.3.2.  File: Second, Node: Error Messages, Up: (Basic)Top Prev: Functions ERROR CODE Severity Standard in Error Messages Character Severity Meaning % Warning Execution of the program can continue but may not generate the expected results. ? FATAL Execution cannot continue unless you remove the cause of the error. No space or tab is allowed after the question mark. Information A message beginning with neither a question mark nor a percent is for information only. Some Common User-Recoverable Error Messages ERR Message Printed Meaning 2 ?ILLEGAL FILE NAME The filename specified is not accept- able. It contains characters which are unacceptable or the filename specification format is incorrect. 5 ?CAN'T FIND FILE OR ACCOUNT The file or account number specified wasn't found on the device specified. 7 ?I/O CHANNEL ALREADY OPEN An attempt was made to open one of the twelve I/O channels which has already been opened by the program. 9 ?I/O CHANNEL NOT OPEN Attempt to perform I/O on one of the twelve channels which has not been previously opened in the program. 10 ?PROTECTION VIOLATION The user was prohibited from preforming the requested operation because the kind of operation was illegal or because the user did not have the privileges necessary. 11 ?END OF FILE ON DEVICE Attempt to perform input beyond the end of a data file; or a BASIC source file is called into memory and is found to contain no END statement. 16 ?NAME OR ACCOUNT NOW EXISTS You tried to rename a file with the name of a file that already exists. 28 ?PROGRAMMABLE ^C TRAP A CTRL/C combination was typed while an ON ERROR GOTO statement was in effect and programmable CTRL/C trapping was enabled. 47 ?LINE TOO LONG Buffer overflow because of an attempt to input a line longer than 255 characters. 50 %DATA FORMAT ERROR A READ or INPUT statement detected data in an illegal format. For example, 1.3 is an improperly formed integer. 51 %INTEGER ERROR Attempt to use a computed integer outside the range -32768