Language Structure

IB Statements

File System

Comet 32 Runtime


FORMAT statement

Syntax: format-statement-label FORMAT format objects
Discussion: The format-statement-label is a numeric or alphanumeric label used to identify the FORMAT statement. In its numeric form, this label may be one to four digits long (e.g., 1, 10, 100, 1000). The Internet Basic compiler treats a FORMAT label as a string of characters, rather than as a numeric value. This means that labels such as 1, 01, 001, and 0001 are all different from each other.

Alphanumeric format statement labels may up to 32 characters long. Alphanumeric labels must begin with a letter and end with a colon (:) when being defined. References to this label from the Procedure Division do not include the colon. Characters following the first one may be alphabetic or numeric. No special symbols or blanks are allowed in format statement labels.

Note: Internet Basic supports two types of statement labels, format statement labels and procedural statement labels. The compiler treats these in different groups, so it is possible to have the same label in the I/O Format Division and in the Procedure Division.

The format objects include numeric constants or variables, string constants or variables, and formatting control codes. If more than one format item is included in a FORMAT statement, a semicolon (;) must be used to separate the items.

Label   Keyword   Format items
In this example, the format statement label is INFO. The three format items are:
  • a control code -- the (WC) mnemonic instructs the program to write a message to the control line of the terminal
  • a string constant -- the message "NOW PROCESSING RECORD"
  • a string variable -- CUSTNUM$
Additional discussion: In a larger context, this FORMAT statement would be invoked with a PRINT statement in the Procedure Division of the program, as follows:
The PRINT statement instructs the system to print to logical unit number 0 (the video screen in this case) using the format statement label INFO.