Guide: migrate from the mainframe (IMS DL/I)¶
IMS databases are trees of segments in hierarchic sequence. OliviaDB stores trees in that
same order, so a DL/I application moves without being rewritten: its DBDs and PSBs are
read as they are, its data is reloaded from IMS unloads, and its COBOL, PL/I, C or Java
programs keep calling CBLTDLI against liboliviadb_dli. New applications then reach the
same data over the network API, under profiles. This guide is the order to do it in.
1. Take the definitions over¶
DBDGEN and PSBGEN sources are the input, unchanged: the DL/I layer parses them itself
(lib/*.dbd, lib/*.psb). oliviadb schema export shows them in the schema language,
the form new applications and profiles are written in (every attribute without a place in
the schema language is kept in ims members, so nothing is lost):
DBD NAME=PARTDB,ACCESS=(HIDAM,VSAM)
SEGM NAME=PART,PARENT=0,BYTES=20
FIELD NAME=(PARTNO,SEQ,U),BYTES=6,START=1
FIELD NAME=DESC,BYTES=14,START=7
SEGM NAME=STOCK,PARENT=PART,BYTES=10
FIELD NAME=(LOC,SEQ,U),BYTES=4,START=1
FIELD NAME=QTY,BYTES=6,START=5
DBDGEN
FINISH
END
PCB TYPE=DB,DBDNAME=PARTDB,PROCOPT=A,KEYLEN=10
SENSEG NAME=PART,PARENT=0
SENSEG NAME=STOCK,PARENT=PART
PSBGEN LANG=COBOL,PSBNAME=PARTPSB
END
oliviadb schema export --lib lib --name parts > parts.olv
oliviadb schema check parts.olv
cat parts.olv
The DBD becomes aggregate PARTDB root PART with STOCK as a child type; the PSB becomes
profile PARTPSB for program "PARTPSB" with one grant per segment and processing option.
The keys keep the DL/I format (format 1: the sequence field's bytes), so the database is
served by the DL/I layer, to programs, to the read-only HTTP view and to SQL; native
aggregates of the network API take typed keys (format 2).
2. Move the data¶
| From | With | Notes |
|---|---|---|
| An HD Reorganization Unload, HISAM, SHISAM, DEDB unload | oliviadb-migrate load --format hd\|hisam\|shisam\|dedb --dbd NAME --in FILE |
OliviaDB Enterprise; keys, secondary indexes and logical relationships rebuilt (operations) |
| OliviaDB's text extract | oliviadb load --store DIR --lib DIR --in FILE |
every build; lossless, layouts kept (operations) |
| A live IMS database, kept in step | the replica (change capture applied in order) | OliviaDB Enterprise (status) |
Data stays in its encoding (EBCDIC by default, --ascii for ASCII programs): packed and
zoned decimals, binary fields and the bytes outside any field are kept as IMS wrote them.
oliviadb check verifies a loaded store (pointers, indexes, logical relationships).
3. Run the programs¶
In process, as a batch job runs today: the program (GnuCOBOL, C; Rust, Java and Python
through their bindings) links liboliviadb_dli, which opens the store directly, schedules the
PSB and takes the calls. One process owns a store at a time. Step by step, with a COBOL
program, a C host and the bindings: DL/I from COBOL, C, Rust, Java and
Python.
Through one server, as online programs share IMS: oliviadb-server holds the stores
(dli.programs in its configuration, or OLIVIADB_DLI_PROGRAMS in the image), and every
program's library sends its calls there (OLIVIADB_DLI_SERVER=host:7655 or a Unix
socket). Programs are isolated as IMS's program isolation isolates them; a deadlock ends one
with BC or U0777; a program whose connection drops is backed out to its last commit point
(DL/I programs, client mode).
COBOL compilers. GnuCOBOL is tested (CI on Ubuntu 24.04, and macOS arm64). Programs
call CBLTDLI with the parameter count first or without it, as on IMS; on Apple arm64 the
library has fixed-argument entry points for callers that do not use the variadic
convention (platforms).
4. What is covered, what is not¶
- Covered: full-function databases (HDAM, HIDAM, HISAM, SHISAM, HSAM, SHSAM, GSAM, secondary INDEX and LOGICAL databases), the database calls (GU, GN, GNP and hold forms, ISRT, REPL, DLET), SSAs with command codes and boolean qualification, secondary indexes, logical relationships, variable-length segments, your own HDAM randomizing routines, FLD, and the system service calls CHKP, XRST, ROLL, ROLB, ROLS, SETS, SETU, SYNC, INIT, INQY, LOG, DEQ, STAT, SNAP, RLSE. Every status code, row by row, with its test or the reason it cannot occur: status code coverage.
- Extensions (OliviaDB Enterprise): Fast Path (DEDB, MSDB), HALDB, the IMS unload readers, change capture from IMS logs.
- Not there: the transaction manager (message queues, MPP/IFP regions, terminals), EXEC DLI command-level programs (a host translates them to calls), the CICS DL/I interface, the IMS catalog database (GUR is refused), the Utility Control Facility. A program that needs one of them gets a status or error that names it, never a silent success.
5. Open the data to new applications¶
Once the data is in OliviaDB, new code reads it without touching the programs:
- HTTP and the native protocol, read only, under a view PSB with field masks and row
rules:
GET /v1/dli/PARTDB/PART/P00011(DL/I databases). - SQL: the SQL projection serves the databases as read-only tables over the PostgreSQL protocol, for reports and BI tools.
- AI agents read through agent PSBs and MCP (agent data access); field meanings can be derived from the COBOL copybooks (semantic catalog).
Ask your agent
Using the oliviadb-migrate skill, take the DBDs and PSBs in ims/lib, export them to the
schema language, load the HD unload in ims/unload/PARTDB.unl into a new store, check
it, and run the COBOL program src/PARTUPD.cbl against it with GnuCOBOL, first in
process, then through a local server.