Introduction

Language Structure

IB Statements

File System

Comet 32 Runtime

Index

SET directive

Syntax:
SET symbolic-constant = numeric-constant

or

SET symbolic-constant$ = "string-constant"
Discussion: The SET statement defines a symbolic constant.

The SET statement is a compiler directive. As such, it causes an action to occur when the program is compiled, not when the program is executed. The SET directive can appear anywhere in an Internet Basic source program.

The SET directive is primarily used to make source program interpretation easier for the programmer.

The symbolic-constant is a name that will be replaced at compile-time with a specific value. The symbolic-constant itself may be up to 32 characters long.

The numeric version of the SET directive performs a compile-time replacement of a symbolic-constant with a specific integer value. For example, consider the following program lines:

SET CUSTFILE=9                        ! Set symbolic constant
.
.
.
OPEN (CUSTFILE) "C1A",EXCP=9999       ! Open customer file
.
.
.
READ (CUSTFILE,5000) EXCP=8000        ! Read record
.
.
.
WRITE (CUSTFILE,5000) KEY=CUSTNUM$    ! Write record
As you can see, the symbolic constant in the above example is the word "CUSTFILE". When this program is compiled, the compiler will replace all occurrences of CUSTFILE with the a 9.

In Comet 504, the SET statement was expanded to include a string as the symbolic constant. The "string SET" statement replaces the symbolic constant with a specific string constant when the program is compiled. The string constant may contain up to 254 characters.

For example:

SET Filename$ = "Customer Master File"
.
.
.
PRINT (0) "The file name is "; Filename$