Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
Syntax: | USE usefile-name [,directory-name] [,starting-edit-line-number] | ||||
Discussion: |
The USE 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 USE directive can appear anywhere in an Internet Basic source program.
The usefile-name parameter is the name of the Internet Basic usefile to be merged. This name must be enclosed in matching quotation marks (single or double). The usefile may be a text file or a Comet Editor (CED) file. The directory-name parameter (optional) represents the name of the Comet directory where the usefile is stored. If the usefile is a Comet Editor file, a single usefile may actually contain multiple segments of code to be merged into the main program. In these cases, the USE directive must specify the starting location in the usefile itself (otherwise the Internet Basic compiler will start at the beginning of the usefile). The starting-edit-line-number (optional) is the Comet editor line number in the usefile where the merging is to start. Note: If you include multiple program segments in a single usefile, you must conclude each segment with the ENDUSE directive or the END statement. This way, the compiler will merge lines up to the ENDUSE directive or END statement, but not beyond. The statements in the usefile will be merged into the program section where the USE directive appears. Therefore, the usefile must contain the same kind of statements (e.g., Data Division, I/O Format Division, or Procedure Division) as the section of the program where the USE directive appears. Usefiles may be nested to two levels. This means that a usefile may contain another USE directive. In this case, the secondary level program lines will be merged into the primary usefile, and those lines will be merged into the main object program. | ||||
History: |
| ||||
Example: |
This example shows a main program that merges a single
usefile into the resulting object program at compile time. The
usefile is a text file named "CUST."
Main program
Usefile named "CUST"
|