# 8. Display Files and Screen Generation

## 8.1 Overview

Display files control how data records are presented on screen. Two types exist:
- **.DI** -- Binary display file for local use in Program SCIENTRY
- **.HTM** -- HTML display file for Internet use in Program CGIENTRY

Both are generated from the same text file (.TX) and format file (.F).

## 8.2 Creating a Text File (.TX)

A text file is almost a replica of what will appear on screen. Three special characters are chosen that are not used in the fixed text:

| Character | Purpose |
|-----------|---------|
| `@` (suggested) | Alphanumeric field marker (letters and numbers) |
| `#` (suggested) | Numeric field marker (numbers, also allows `$`, `,`, `.`, `/`) |
| `^` (suggested) | Ruling character set (line drawing, boxes) |

One marker character is used for each character position in the field.

### 8.2.1 Example Text File (AMAIL.TX)

```
0^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1^          SORT CODE: @@@@@@@@@@                             ^
2^TITLE,1ST/LAST NAME: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         ^
3^            ADDRESS: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         ^
4^      BUSINESS NAME: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         ^
5^CITY: @@@@@@@@@@@@@@  STATE: @@   ZIP: #####  ZIP EXT: #### ^
6^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

### 8.2.2 Rules

- Character position 1 in the text file is not available for use on screen. Use it for line numbering.
- Maximum 192 lines (screens of 23--24 lines each; line 24/25 is the status line).
- Maximum 2,047 fields per text file.
- Maximum 450 fields visible at any one time.
- Maximum record length: 4,095 characters.
- The file must be saved as ASCII with fixed-width (non-proportional) spacing.

### 8.2.3 Column 1 Convention (for Replica Reports)

- A **number** in column 1 means the line is a printing line with one unit of vertical spacing.
- A **blank** in column 1 means the line is skipped for printing (no vertical spacing).
- An **asterisk** (`*`) in column 1 causes the printer to advance to the next page.

## 8.3 The DISPLAY Batch File

The entire generation process is performed by:

```
>>? AC DISPLAY [fnprefix] [alpha char] [numeric char] [ruling char]
```

Example:
```
>>? AC DISPLAY AMAIL @ # ^
```

This batch file executes four programs in sequence:

### 8.3.1 Program EASYFORM

Reads the text file and creates a primitive format file (.PF) with basic field information (field number, starting position, length, type, format code for Mercury).

```
>>? RUN EASYFORM
? [fnprefix.TX] [+fnprefix.PF] [A designator] [N designator]
```

### 8.3.2 Program EASYDISP

Converts the primitive format file and text file into a complete format file (.F) with display position information.

```
>>? RUN EASYDISP
? [fnprefix.PF] [fnprefix.TX] [+fnprefix.F] [A designator] [N designator]
```

### 8.3.3 Program DISPPREP

Reads the text file and format file to produce the binary display file (.DI) for Program SCIENTRY.

```
>>? RUN DISPPREP
? [fnprefix.TX] [fnprefix.F] [+fnprefix.DI] [A char] [N char] [ruling char]
```

### 8.3.4 Program HTMLPREP

Reads the text file and format file to produce the HTML display file (.HTM) for Program CGIENTRY.

```
>>? RUN HTMLPREP
? [fnprefix.TX] [fnprefix.F] [+fnprefix.HTM] [A char] [N char] [ruling char]
```

## 8.4 The DISPLAY Batch File Contents

```
DEFINE JL1
DEFINE &1.F
DEFINE &1.DI
DEFINE &1.HTM
DEFINE &1.DA
CF &1.F
CF &1.DI
CF &1.HTM
CF &1.DA
RUN EASYFORM
 &1.TX JL1 &2 &3
RUN EASYDISP
 JL1 &1.TX &1.F &2 &3
RUN DISPPREP
 &1.TX &1.F &1.DI &2 &3 &4
RUN HTMLPREP
 &1.TX &1.F &1.HTM &2 &3 &4
```

## 8.5 Enhanced Display Capabilities

To customize a format file for enhanced display:

1. Run the DISPLAY batch file to generate initial files.
2. Edit the format file, changing character 63 (field type):
   - `H` -- visible, transmittable alphanumeric field
   - `I` -- visible, transmittable numeric field
   - `J` -- visible, protected (read-only) field
   - `K` -- invisible, protected (hidden) field
3. Rerun Program DISPPREP with the modified format file.
4. Check the result using the ENTRY batch file.

## 8.6 Menu Generation

Chaprola allows unlimited sets of display, data, and procedure files to be accessed without leaving the screen. The technique:

```
MOVE "#bb#####[prefix1][prefix2][prefix3]" 6023 32
```

Where:
- `#` is the IVAL value (0--8)
- `bb` is two blank spaces
- `#####` is the record number (e.g., 00001)
- `[prefix1]` is the display file prefix (8 chars)
- `[prefix2]` is the data file prefix (8 chars)
- `[prefix3]` is the procedure file prefix (8 chars)

---

*Previous: [Format Files](07-format-files.md) | Next: [SCIENTRY](09-scientry.md)*
