# 6. Files and File Types

## 6.1 Overview

All software resides in the system as a set of files. User files are broken into seven categories based on their intended use. A logical naming convention uses the same filename prefix (fnprefix) across related files.

## 6.2 File Types

### 6.2.1 Data Files (.DA)

Data files contain the information that makes the entire system meaningful. They are collections of character strings, each called a data record. The records within a data file are fixed length but can vary from file to file. Data files are created and maintained using entry programs (e.g., SCIENTRY) or batch programs (e.g., CHAPRPG). Data files may be sorted, manipulated, and retrieved.

**Properties:**
- Fixed-length records
- Maximum record length: 4,095 characters
- Maximum records per file: 32,000
- Created as "flat" files (Fixed Length ASCII Text)
- Self-defining through associated Format files

### 6.2.2 Text Files (.TX)

Text files are prepared by the user to define screen displays. A text file is almost a replica of what is to appear on the screen. It contains the layout for both the fixed text descriptions of fields and the location of fields on the screen.

**Properties:**
- Must be ASCII, not proportionally spaced
- Maximum 192 lines
- Character position 1 is not available for use on screen
- Created using a text editor or word processor

### 6.2.3 Format Files (.F)

Format files are generated by the system (via programs Easyform and Easydisp). Each format file has one line per field, with a fixed record length of 80 characters. The format file describes the structure of a corresponding data file.

See [Format Files](07-format-files.md) for the detailed specification.

### 6.2.4 Display Files (.DI and .HTM)

Display files are generated by the system (via programs Dispprep and Htmlprep):
- **.DI** -- Binary display file for local use in Program SCIENTRY
- **.HTM** -- HTML display file for Internet use in Program CGIENTRY

See [Display Files](08-display-files.md) for details.

### 6.2.5 Procedure Files (.PR)

Compiled Chaprola bytecode programs. Created by compiling .CS source files through CHAPTRAN and CHAPCOMP. Executed by SCIENTRY (via F10), CGIENTRY (via X command), or CHAPRPG.

### 6.2.6 Chaprola Source Files (.CS)

Source files contain commands written in the Chaprola language. These are created by the user using any text editor.

### 6.2.7 Batch Files

Batch files contain lists of commands for batch processing. These simple text files list commands that would have been typed by hand. Executed using the `AC` (assign console) command.

## 6.3 Naming Convention

All related files share the same filename prefix:

```
AMAIL.DA   -- data file
AMAIL.TX   -- text file
AMAIL.F    -- format file
AMAIL.DI   -- display file (local)
AMAIL.HTM  -- display file (Internet)
AMAIL.CS   -- Chaprola source module
AMAIL.PR   -- procedure file (compiled from AMAIL.CS)
```

**Note:** Only the .TX and .CS files are generated manually by the user. The other files (.F, .DI, .HTM, .PR, .DA) are generated by SCIOS system programs or by user entry through supplied programs.

## 6.4 Additional File Types

| Extension | Description |
|-----------|-------------|
| `.P` | Print file (output from PRINT command) |
| `.DB` | Debug file (output from DEBUG command) |
| `.PF` | Primitive format file (intermediate, created by Easyform) |
| `.DS` | Sorted data file |
| `.DC` | Change/correction file |
| `.DN` | Non-sorted master file |

## 6.5 File Definition

In SCIOS, a user must explicitly define a file before it is available for use as an output file. Methods:

1. At the operating system prompt: `>>? DEFINE [filename]`
2. Within a program command: precede the filename with `+` (e.g., `+MYFILE.DA`)

The `+` prefix tells the system to define the file if undefined and to clear write-protect flags if it is read-only.

## 6.6 Limits

| Resource | Limit |
|----------|-------|
| Maximum lines in a text file | 192 |
| Maximum fields per text file | 2,047 |
| Maximum visible fields at one time | 450 |
| Maximum record length | 4,095 characters |
| Maximum records per data file | 32,000 |
| Maximum filename prefix length | 8 characters |

---

*Previous: [Error Codes](05-error-codes.md) | Next: [Format Files](07-format-files.md)*
