> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metaphi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Concepts

> Mainframe terms mapped to distributed systems, and the objects Harwell works with.

## Mainframe terms

| Mainframe | Closest distributed equivalent | In Harwell |
| - | - | - |
| Data set | A file. Its name (`PAY.INPUT`) is a flat dotted name in a catalog, not a path | A file in `CATALOG/`, named by its data set name |
| Record format and LRECL | A fixed or length-prefixed record layout. A fixed-format data set has no newlines | `CATALOG/_geometry.json`: `{"PAY.INPUT": {"lrecl": 15, "recfm": "FB"}}` |
| VSAM KSDS | A key-value file, ordered by key | A `cluster` in `_geometry.json` |
| GDG | A rotating series of versioned files: `BASE(0)` is the newest, `BASE(+1)` the next | Allocated by JCL, kept on the volume |
| Program | A binary, named by its `PROGRAM-ID` | A `.cbl` file in any subdirectory of the unit |
| Copybook | A header file pulled in by `COPY` | A member of `Copybooks/` |
| JCL job | A shell script that runs steps in order | A deck in `Procs/` |
| Step (`EXEC PGM=`) | One command of the script | One line of the job log, with its return code |
| DD statement | A file handle bound to a name, like an environment variable naming a path | Binds a program's file to a data set or to `SYSOUT` |
| Return code (RC) | A process exit code. 0 is clean, 4 is a warning, 8 and up is an error | `rc` on each step |
| Abend | A crash with a code, such as `S806` (program not found) or `S0C7` (bad numeric data) | The step's status and `diagnostics` with severity `abend` |
| Spool and SYSOUT | stdout and stderr, kept per job, step and DD | Resource links on the result |
| Cataloged procedure (PROC) | A shell function a job calls | A `.jcl` member of `Procs/` |
| CICS region | An application server | Declared in `run.json` `cics`, or by a codebase |
| Transaction ID | A route, four characters, typed at the terminal | `cics.transactions`: transaction ID to program |
| Task | One request handled by the server | One screen in `cics.screens` |
| BMS map | A screen template | Macro source in `BMS/`, assembled on every run |
| COMMAREA | Session state passed from one request to the next | Returned by `RETURN TRANSID`, handed to the next task |
| Pseudo-conversational | Stateless request handlers with state in a session token | Each attention key starts a new task with the last COMMAREA |
| Db2 | A relational database | `DB/seed.sql`, `EXEC SQL`, the `sql` tool |
| SQLCODE | A SQL status: 0 success, 100 no row, negative an error | Reported per statement in `diagnostics` |

## Unit

A directory in a mainframe codebase's own shape, plus a `run.json` that says what to run: compile programs, submit jobs, run a chain of jobs or start a transaction. `run_unit` and `open_terminal` take a unit. See [Unit format](https://docs.metaphi.ai/harwell/unit-format.md).

## Codebase

A directory with a `harwell.toml` at its root: a real estate's programs, copybooks, procedures and region, run in place. `submit`, `start` and `open_terminal` take a codebase by repository or as a tree you send. See [Run a codebase](https://docs.metaphi.ai/harwell/guides/codebases.md).

## Volume

The state a run starts from and leaves: the catalog and its data sets, the Db2 tables and the region's queues. By default each call gets a fresh volume, discarded when the call ends. Set `return_work` to keep it: the result names it by `work_id`, and a later call starts from it. The `sql`, `list_datasets` and `read_dataset` tools read a kept volume.

## System

A named volume that persists across calls. Name it as `system` on `run_unit`, `submit`, `start` or `open_terminal`: the call starts from the state the system's last call left, and its own state becomes the system's next. Batch jobs, transactions and a person at a terminal all work on the same data. See [Keep state](https://docs.metaphi.ai/harwell/guides/systems.md).

## Result

`run_unit`, `submit` and `start` return one shape:

* **Text.** The verdict on the first line, then compile errors at `file:line`, the job log, each screen sent as 24 rows of 80 characters, and what programs displayed.
* **`structuredContent`.** The same as JSON: `status` (`ok`, `failed` or `error`), `verdict`, `diagnostics`, `jobs` with each step's return code, `work_id` when the volume was kept, and `system` when the call ran on one.
* **Resource links.** `report.json`, every listing, every step's output and every spool file, each at a `harwell://runs/<run>/<name>` URI. Read one with `resources/read`. Only your organization reads them.

A result whose `status` is not `ok` is a tool error.

## Terminal

A browser page where a person drives a transaction by hand at a 24 by 80 screen. `open_terminal` returns its link. The person presses keys, marks each turn right or wrong, and closes it. `read_terminal` returns the screens they pressed, an oracle from the turns they marked right, and their notes. See [Drive a CICS transaction](https://docs.metaphi.ai/harwell/guides/cics-transactions.md#hand-it-to-a-person).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.