/mainframe-cobol-db2:db2-postgresql-migrationfrom mainframe-cobol-db2
Models DB2 for z/OS tables, DDL, DCLGEN structures, COBOL record layouts, OCCURS/REDEFINES groups, packed decimals, cursors, and VSAM datasets as PostgreSQL schemas, then proves equivalence via reconciliation numbers.
Ships in mainframe-cobol-db2. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Turn inspected DB2 and COBOL record structure into a relational schema that preserves precision, occurrence semantics, and access paths, and prove the result with reconciliation numbers instead of assertions.
| DB2 or COBOL source | PostgreSQL | Rule |
|---|---|---|
CHAR(n) | char(n) or varchar(n) | DB2 CHAR is blank-padded. Decide whether trailing blanks are significant before choosing. |
VARCHAR(n) | varchar(n) or text | Confirm the declared maximum against real data before shortening it. |
GRAPHIC, VARGRAPHIC | text | Confirm the source CCSID; do not assume UTF-8. |
DECIMAL(p,s), COBOL COMP-3 | numeric(p,s) | Precision and scale come from the DDL or the PIC clause, never from a sample value. |
NUMERIC, zoned PIC 9 display | numeric(p,s) | Check sign handling: SIGN LEADING, SIGN TRAILING, and SEPARATE change the stored bytes. |
SMALLINT, INTEGER, BIGINT, COMP | smallint, integer, bigint | Match the binary width; COBOL COMP width depends on the PIC digits and compiler options. |
REAL, DOUBLE, FLOAT | real, double precision | Never use these for money, quantities, or anything summed and compared. |
DATE, TIME, TIMESTAMP | date, time, timestamp | DB2 TIMESTAMP can carry more fractional digits than the target default; state the precision. |
Date as PIC 9(8) | date | Confirm the stored pattern, usually YYYYMMDD, and reject impossible values instead of coercing them. |
ROWID, IDENTITY | Surrogate key plus a retained legacy column | Never expose a physical identifier as business identity. |
BLOB, CLOB | bytea, text | Confirm size limits and whether the value is ever compared or indexed. |
Monetary and quantity fields keep exact decimal types end to end: numeric in PostgreSQL, BigDecimal
in Java, and a string in JSON. A single conversion through a binary floating type is enough to break a
reconciliation.
| Legacy structure | Default PostgreSQL shape | Use an alternative only when |
|---|---|---|
| DB2 table | Table | Never merge two tables into one without a recorded decision. |
| Column | Column | The column is a documented composite that programs always split. |
OCCURS fixed group | Child table with (parent_id, occurrence) | Order and cardinality are bounded, values are never queried individually, and an array is a recorded decision. |
OCCURS DEPENDING ON | Child table with (parent_id, occurrence) | Never. The controlling count is data and must survive the migration. |
REDEFINES | One column per real interpretation, plus a discriminator | Never collapse to a single column; the active reading is decided by program logic. |
Nested OCCURS | Grandchild table with both ordinals | Never. Both occurrence dimensions are meaningful. |
| Primary and unique index | Primary key and unique constraint | Uniqueness was never enforced in the legacy data. |
| Secondary index | Index on the mapped columns | The index is unused by every inspected program and query. |
| VSAM KSDS | Table with a unique key on the mapped record key | The dataset is a pure sequential extract with no key semantics. |
| Sequential dataset | Staging table or file-backed load | The data is transient and never queried. |
Store the occurrence ordinal explicitly. Occurrence position is often load-bearing in reports, control breaks, and "first entry wins" logic.
WITH DEFAULT and NOT NULL WITH DEFAULT change what an absent value means. Map each column explicitly.FOR UPDATE implies locking behavior; a cursor without ORDER BY has no guaranteed order
even when the legacy report appears sorted.SQLCODE +100 is a normal empty result. The migrated query must produce the same empty-result behavior,
not an error.CHAR comparisons include trailing blanks. Moving to varchar changes equality results.OCCURS DEPENDING ON record read with the maximum length reads past the
real data. Migrate the actual count, not the maximum.Equivalence is a measurement, not a claim. Run these against the same input and record actual numbers.
OCCURS entries versus child-table row counts.count, count of non-null, sum, min, and max, compared at
full precision.Report every number that was produced and every check that could not run. A reconciliation reported without numbers is not evidence.
## DB2 to PostgreSQL mapping
**Status:** proposed | reviewed | reconciled | blocked
**Scope:** <DB2 table, copybook, or dataset>
### Column mapping
| Source field | Type | Target column | Type | Rule or risk | Evidence |
| --- | --- | --- | --- | --- | --- |
### Structure mapping
| Structure | Target shape | Rationale | Evidence |
| --- | --- | --- | --- |
### Access paths
| Index or cursor | Target index | Uniqueness proven | Evidence |
| --- | --- | --- | --- |
### Reconciliation
| Check | Legacy value | Target value | Match | Evidence |
| --- | --- | --- | --- | --- |
### Open questions and accepted deviations
- <question or deviation, owner, decision reference>
PIC clause rather than a sampled value.OCCURS, OCCURS DEPENDING ON, and REDEFINES structures preserve occurrence identity, order, and count.SQLCODE +100 paths.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
db2-migration, cobol, postgresql-schema, legacy-data, type-mapping, reconciliation
15 skills in this plugin
/cobol-db2-analysisAnalyze COBOL programs, copybooks, PERFORM and CALL structure, file and VSAM access, embedded EXEC SQL and EXEC CICS, DB2 DDL, DCLGEN structures, cursors, and JCL job steps with source citations. Use when reading or inventorying a COBOL/DB2 legacy system before modernization./cobol-db2-contextSupply COBOL, DB2, VSAM, and JCL modernization context: corpus layout, member conventions, target stack boundaries, evidence precedence, stage flow, and security rules. Use when starting any COBOL/DB2 modernization task, before analysis, design, implementation, verification, or delivery./cobol-db2-loopRun each COBOL/DB2 modernization phase as a bounded correction loop with observable exit gates, an iteration ledger, upstream defect escalation, and an engineering graph extracted from COBOL, copybooks, JCL, and DB2 DDL. Use when opening or closing a COBOL/DB2 phase loop, deciding whether a gate passes, routing a defect to the phase that owns its root cause, or building and querying the modernization graph./cobol-legacyApplies COBOL, copybook, and JCL reading conventions for evidence, precision, occurrence semantics, and legacy immutability. Use when inspecting or citing COBOL/DB2 legacy source./code-modernizationUse this skill when the user asks to modernize legacy code with a disciplined GitHub Copilot workflow: brief, assess, map, extract business rules, reimagine architecture, transform modules, and harden with tests and security review. Trigger for COBOL, JCL, legacy Java, .NET, C++, classic ASP, monolith modernization, behavior-preserving rewrite, business-rule extraction, modernization assessment, or legacy-to-modern transformation./create-architectural-decision-recordCreate an Architectural Decision Record (ADR) as a structured Markdown document with front matter, coded consequences, alternatives, implementation notes, and references. Use when the user asks to document an architecture decision, create an ADR, capture alternatives and trade-offs, or save a decision under docs/adr.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin mainframe-cobol-db2Other plugins' skills for the same job