Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

Overview FORMAT statement Format objects Video formatting Printer formatting

Overview Video Control Codes

Video Screen Formatting Overview

Video screen formatting can be the most challenging step in designing an application program in MTB. To make this process easier, we have included some video screen formatting tips.

Consider the video screen as an 80 column by 24 line (or 64 column by 27 line) canvas which can be "painted" with background prompts, data fields to be entered, and special codes to handle data transmission. Each screen coordinate must be accounted for in the formatting process.

Video screens are often designed to match paper forms, and the programmer should be aware of some considerations, including natural cursor movement and block data transmission.

From a programming point of view, the easiest type of screen format is the scrolling screen. MTB refers to scrolling screens as "typewriter mode." In typewriter mode, each new line written to the screen is written on the bottom display line in background characters (pushing the previous top line off the screen). One transmit mark is placed immediately after the prompt, and another is placed at the end of the bottom line. The cursor is placed in the foreground area following the first transmit mark this is the data entry field.

When the user presses the Enter, Tab, or Return key, the cursor jumps over the second transmit mark and the data in the foreground field is transmitted to the host system. Thus, typewriter mode handles only one field at a time.

The alternative to typewriter mode is "normal mode." In normal mode, the screen display does not scroll; instead, the cursor moves from field to field starting at the upper left and moving down and towards the right.

In normal mode, the programmer must carefully select display characteristics for all areas of the screen. For example, prompts are usually displayed as background characters so the cursor will not move into a prompt area. (Also, only foreground areas can be used for data entry purposes.)

The programmer must also place transmit marks around fields to be transmitted to the host system. If a single field is to be transmitted to the receiving program, a transmit mark must be placed before and after the field (usually immediately before and after).

One advantage offered by MTB is its ability to transmit a block of data consisting of more than one field. In this case, a transmit mark must be placed before the first field, and another one must be placed after the last field in the block. When the cursor is positioned between these two marks, the data entered is held in the video device's memory (and does not get transmitted to the host system immediately).

This means that the operator can move from field to field (up or down) to edit the data. When the second transmit mark is crossed (a result of the operator pressing the Tab, Return, or Enter key at the last field in the block), the entire block of data is transmitted to the host system filling multiple variables in the program being run.

The following program segment demonstrates this technique:

  1000 FORMAT A$;B$;C$;D$;E$;F$
  INPUT (0,1000)
This example assumes that the screen has been formatted to receive six string fields the prompts and intervening lines must be background characters, the data entry areas must be foreground, and there must be a transmit mark on the screen before the first data entry area and another transmit mark following the sixth data entry area (as shown in the following diagram).

PROMPT 1: TM ______________________

PROMPT 2: _______________________

PROMPT 3: _____________________________

PROMPT 4: _________________

PROMPT 5: _________________________________

PROMPT 6: _______  TM

When the program reaches the INPUT statement, it will remain there until the operator fills in the six data entry areas and presses the Tab, Return, or Enter key at the sixth field (causing the cursor to jump over the second transmit mark). When this happens, the data from the video device will be transmitted to the host system and will be placed in the variables in the FORMAT statement (in this case, A$, B$, C$, D$, E$, and F$).

Natural cursor movement is an important consideration when creating screen displays. The programmer should design a screen display with the operator's actions in mind. Thus, the initial data entry fields are usually placed at the top of the screen, and others are placed below in some logical sequence.

The cursor moves to the right and down depending on the key pressed by the operator. The Tab key moves the cursor to the right first, then down. This means that multiple data entry fields may be placed on the same line of the screen the operator moves by pressing the Tab key.

The Return key and Enter key move the cursor down without moving it to the right first. This means that multiple data entry fields on the same line will be skipped if the operator presses the Return or Enter key.

The Transmit key or F10 function key causes the cursor to immediately jump ahead to the next transmit mark regardless of where the cursor is located when the key is pressed. This means that the operator can abort a block data entry session early by pressing the Transmit or F10 function key.

When the cursor enters a data entry field, it normally appears at the left hand side of the field. The field accepts all keys from the keyboard, including the alphabetic keys, numeric keys, and special characters. For some data entry fields, this may not be acceptable, so the (RJ) control code may be used to establish a right justified field.

A right justified field accepts only numeric values and a minus sign (for negative numbers). All other data is prevented from being entered into the field. A field becomes right justified when the (RJ) control is placed immediately before the field on the screen display. Each field to be right justified must contain its own (RJ) mark.

This documentation contains detailed descriptions and programming examples of all the control codes recognized by MTB. Note: There are additional hexadecimal formatting controls recognized by various devices that may be connected to a Comet system. These hex controls are described in the documentation accompanying each product and are not covered herein.