Keywords are special variables which begin with the character &. Some of them can be set to different values by the user while some cannot. They are used to control and observe various run-time aspects of the program and retrieve pattern primitives.
&ABEND If a nonzero value is assigned to &ABEND, the low order 8 bits of the binary representation of the integer are used to set the DOS ERRORLEVEL which can be tested by DOS batch commands IF and ERRORLEVEL. This means that ERRORLEVEL can be set to any value from zero through 255 (for positive &ABEND, it is the remainder after dividing &ABEND by 256). An error message is also printed if &ABEND is not zero. These events happen when the SNOBOL4.2 program terminates. If &ABEND is zero, but &CODE is not zero, the low order 8 bits of the integer &CODE are returned as above for &ABEND, but no error message is printed.
&ABORT is the value of the primitive pattern ABORT. The value of this keyword cannot be changed.
&ALPHABET is a string of the 256 characters in the ASCII collating sequence and those defined by the IBM Personal Computer. It is useful for dealing with non-printable characters. The value of this keyword cannot be changed. See the BASIC manual for a complete table of these characters.
&ANCHOR anchors all pattern matches when its value is nonzero. This is equivalent to placing the primitive pattern POS(0) in front of every pattern being matched. The default value of this keyword is zero.
&ARB is the value of the ARB primitive pattern. The value of this keyword cannot be changed.
&BAL is the value of the BAL primitive pattern. The value of this keyword cannot be changed.
&CODE is used to set a return code for a SNOBOL4.2 program execution. If a nonzero value is assigned to &CODE, the low order 8 bits of the binary representation of the integer are used to set the DOS ERRORLEVEL which can be tested by DOS batch commands IF and ERRORLEVEL. This means that ERRORLEVEL can be set to any value from zero through 255 (for positive &CODE, it is the remainder after dividing &CODE by 256). If an error message is desired, then use &ABEND. If &ABEND is not zero, the value of &CODE is not used.
&DUMP causes a dump of all natural variables and keywords to be printed when the program execution ends, if this keyword value is not zero. The default value of this keyword is zero. The command line option /D causes the keyword &DUMP to default to 1 instead of zero.
&ERRLIMIT sets the number of run-time conditional errors which can be allowed before error termination of execution. Each error decrements this keyword by 1 and causes the statement in which the error occurred to fail. The default value of this keyword is zero.
&ERRTYPE contains the error number of the most recent execution time error. By tracing the value of this keyword, one can intercept non-fatal run time errors. Your program cannot assign a value to this keyword.
&FAIL is the value of the FAIL primitive pattern. The value of this keyword cannot be changed.
&FENCE is the value of the FENCE primitive pattern. The value of this keyword cannot be changed.
&FNCLEVEL indicates at what function invocation depth the program is currently executing. The initial value is zero. The keyword is incremented by one on every call and decremented by one on every return. Your program cannot assign a value to this keyword.
&FTRACE causes all user-defined function calls and returns to be traced with printed records when the value of this keyword is positive. Each trace record printed decrements the value of &FTRACE. See the TRACE() function for more information about tracing.
&FULLSCAN disables the length failure heuristic during pattern matching, when the value of this keyword is nonzero. The default value of this keyword is zero. Please refer to Griswold's SNOBOL4 manual for a detailed understanding of this keyword. Most pattern matches are not affected by quickscan, the default. When fullscan mode is in effect, some patterns may cause much longer execution and even infinite loops.
&INFINITY is the floating point value of infinity. The value converts to the character string 'INFINITY' and can be converted back to a floating point value. Infinity can also be created through computations such as dividing a non-zero number by floating point zero. The value of this keyword cannot be changed.
&INPUT permits input variables to read from their assigned file when this keyword is nonzero. The initial value of this keyword is one. This keyword is useful for disabling input or improving execution speed in sections of the program where there is no input.
&IOERR is an unprotected keyword which contains the DOS error return codes from the last failing input/output operation. These are more fully described in the DOS Technical Reference manual. The most likely errors to occur are listed here:
&LASTNO gives the statement number of the last statement executed. This is useful for debugging your program and for use in programmer error handling routines. Your program cannot assign a value to this keyword.
&MAXARB is a protected keyword which contains the value of the pattern MAXARB. If a new value is assigned to MAXARB, the pattern can be recovered using &MAXARB.
&MAXLNGTH specifies the maximum length character string value allowed. The initial value of this keyword is 5000. Note that this implementation of SNOBOL4 supports character strings up to the length of 32768 characters.
&NAN is the value NAN (Not A Number) as defined for the Math Co-processor. This value is generated by floating point operations for which the correct answer cannot be computed. For example, a floating point divide of zero by zero produces a NAN result. Floating point operations which have a NAN as an input operand propagate the NAN to their results. In this way, the final answer will be NAN if any of the dependent operands were NAN or results from questionable computations. The NAN converts to a character string as 'NAN'. You can test for a NAN in the floating point form by using the IDENT or DIFFER predicates but not LT LE GT GE EQ or NE. The value of this keyword cannot be changed.
&OUTPUT permits output variables to write to their assigned file when this keyword is nonzero. The initial value of this keyword is one. This keyword is useful for disabling output or improving execution speed in sections of the program where there is no output.
&PARM is a character string consisting of the characters on the command line, used to invoke SNOBOL4, after the command name. The value of this keyword cannot be changed.
&REM is the value of the REM primitive pattern. The value of this keyword cannot be changed.
&RTNTYPE is either 'RETURN', 'FRETURN' or 'NRETURN' depending on how the last programmer-defined function returned. The initial value of this keyword is the null string. Your program cannot assign a value to this keyword.
&STAT is a new keyword which can be set to zero if no run-time statistics are to be printed at termination. A nonzero value will cause run-time statistics to be printed on unit 6. &STAT defaults to the value 1. The /Q option on the command line invoking SNOBOL4.2 sets &STAT to zero (for quiet mode).
&STCOUNT gives the number of statements executed. Its value is incremented by one when the statement begins. Your program cannot assign a value to this keyword. If this number reaches the value of &STLIMIT, the program is terminated.
&STFCOUNT gives the number of statements that failed. This keyword is incremented by one when a statement fails. Your program cannot assign a value to this keyword.
&STLIMIT sets the limit for how many statements may be executed in this program before it is terminated. The initial value of this keyword is 2147483647. This keyword is useful for debugging programs that may be going into an infinite loop.
&STNO This keyword gives the number of the statement currently being executed. Your program cannot assign a value to this keyword.
&SUCCEED is the value of the SUCCEED primitive pattern. The value of this keyword cannot be changed.
&TRACE permits a trace record defined by the TRACE() function to be printed when its value is greater than zero. When a trace record defined by TRACE() is printed, this keyword is decremented by one. The initial value of &TRACE is zero.
&TRIM causes all trailing blanks and tabs to be removed from all input records when this keyword is nonzero. The initial value of this keyword is zero.
Prior Page, Next Page, First Page of the Minnesota SNOBOL4 Reference