Propose complete Db2 duplicate precheck keys
ProprietaryAdd missing primary-key equality predicates to an approved COUNT(*) duplicate precheck using the unchanged key hosts of its matching INSERT. Require exact caller, COPY and complete enforced schema snapshots. Resolve one nonnullable CHAR primary key and equal-width ordinary character hosts. Require existing immediate SQLCODE rejection after SELECT, duplicate-count rejection before INSERT, and separate -803 and other-error guards before the literal success report. Prove every existing rejection reaches its approved terminal paragraph. Preserve all guards, SQL result handling and database uniqueness enforcement. Reject mismatched existing predicates, extra nonkey filters, unknown handlers, intervening writes and unsupported SQL forms. Append only the missing predicates and preserve every original byte outside that insertion. Reparse the complete typed SELECT grammar to prove the final key mapping. The precheck does not replace database enforcement or prevent concurrent duplicate attempts. No key, business rule, retry or transaction behavior is invented. Application team review remains required.
io. moderne. mainframe. security. ProposeDb2DuplicatePrecheckKeyRequired
Exact approved COBOL source path.
Exact program ID. Retain quotes for literal IDs.
Lowercase SHA-256 of the complete approved UTF-8 caller without a byte order mark.
JSON mapping every ordinary data COPY to its approved hash. The independently validated system SQLCA is excluded.
One-based EXEC SQL SELECT COUNT(*) line approved as the duplicate precheck for the selected INSERT.
One-based EXEC SQL INSERT line in the same direct paragraph sequence.
One-based literal DISPLAY line approved as the INSERT success report after its result guards.
Root-first dotted declaration of the COUNT(*) result.
Exact qualified unquoted table name in uppercase.
Exact source path of the complete enforced CREATE TABLE approved for this INSERT.
Lowercase SHA-256 of the complete approved UTF-8 schema.
Approved STDSQL(YES) with standalone diagnostics or STDSQL(NO) with an explicit system SQLCA include. The source must prove those declarations.
Existing terminal paragraph approved for failed SELECT and unexpected INSERT SQLCODE values.
Existing terminal paragraph approved for a nonzero duplicate count and every INSERT SQLCODE -803 result.
Provenance of the approved duplicate precheck, complete enforced schema, diagnostic mode, matching INSERT values and existing failure behavior. Approve comparing the complete primary key without changing authorization, cleanup or transaction policy.
mod run . --recipe= io. moderne. mainframe. security. ProposeDb2DuplicatePrecheckKey \
-P sourcePath= security/ cbl/ VDPK001. cbl \
-P programName= VDPK001 \
-P sourceSha256=0000000000000000000000000000000000000000000000000000000000000000 \
-P copybookSnapshots= '{}' \
-P precheckLine=18 \
-P insertLine=26 \
-P successLine=35 \
-P countField= ROW-COUNT \
-P tableName= VTEST. ITEM \
-P schemaSourcePath= security/ ddl/ VDPKEY. ddl \
-P schemaSha256=0000000000000000000000000000000000000000000000000000000000000000 \
-P diagnosticMode= 'STDSQL(NO)' \
-P errorExit= SQL-ERROR \
-P duplicateExit= DUPLICATE-EXIT \
-P contractSource= 'mainframe-fixtures fictional duplicate-key contract'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.