Skip to content

ironwork 0.7.0

Choose a tag to compare

@github-actions github-actions released this 04 Oct 08:52
· 184 commits to main since this release

Summary

ironwork 0.7.0 runs dynamic SQL and programs that take a file's name from a data item, and gives numeric functions the precision IBM documents. A program that PREPAREs and EXECUTEs statements it builds runs instead of ending at its first PREPARE, and an expression holding MAX, MIN or MOD gives Enterprise COBOL's digits.

  • Dynamic SQL: PREPARE, EXECUTE, EXECUTE IMMEDIATE and cursors declared for a prepared statement, against PostgreSQL or a recording, under Db2 13's rules and SQLCODEs.
  • ASSIGN to a data item: under --compliance extended, ASSIGN TO an item's name, ASSIGN DYNAMIC and ASSIGN USING take the DD name from the item's value at each OPEN, and the input trace records it as a dynamic-file-path sink at the SELECT.
  • Numeric function precision: MAX, MIN, RANGE, REM and SUM keep their arguments' decimal places and count them in an expression's intermediate precision; INTEGER, INTEGER-PART and MOD have IBM's digits.
  • MOVE of a numeric function: refused under --compliance strict, as Enterprise COBOL refuses it, and moved at IBM's precision with IWX0008-W under extended.

Limit: DESCRIBE, PREPARE ... INTO and USING DESCRIPTOR are refused by name until the SQLDA is read. An ASSIGN item's value names a DD, never a host path: a path, or a name the run was not given, fails the OPEN with status 35 (C360).

Added

  • PREPARE, EXECUTE [USING], EXECUTE IMMEDIATE, and OPEN, FETCH and CLOSE of a cursor declared FOR a prepared statement, as Db2 13 for z/OS's SQL Reference gives them. The statement string is one varying-length string, as Db2 requires of COBOL; any other declaration abends EXEC and names the rule. PostgreSQL parses a statement at PREPARE, so a bad one is refused there, as Db2 refuses it. ironwork answers -084, -313, -514, -517, -518 and -519 itself. The end of a unit of work destroys its prepared statements, except those of open WITH HOLD cursors, as KEEPDYNAMIC(NO) does (C400). COMMIT and ROLLBACK in a statement string settle the unit of work as the static statements do, and SAVEPOINT and its kin are refused by name.
  • Recordings carry dynamic statements, and a recorded dynamic run replays. The input trace records each statement string as a dynamic-sql sink, before a run without a database is refused.
  • ASSIGN TO a data item, ASSIGN DYNAMIC and ASSIGN USING under --compliance extended, with IWX0007-W. At each OPEN the item's value, its blanks off and folded to upper case, names the DD, as GnuCOBOL maps a plain name through DD_name. Strict keeps Enterprise COBOL's rule that an assignment-name is never a data item, and refuses DYNAMIC and USING (C361).
  • The input trace records the item's value as a dynamic-file-path sink at the SELECT, with each file's own input. Both executors open such a file through the same code.
  • --compliance extended accepts MOVE of an integer or numeric function with IWX0008-W, and moves the function's value at the precision IBM gives it, as IBM moves a numeric item of that precision.

Changed

  • MOVE of an integer or numeric function is refused under --compliance strict, the default, under either dialect: the Programming Guide says numeric functions are not valid as senders in MOVE statements (SC27-8714-03, p. 119). MAX and MIN count as numeric when their first argument is (C394).
  • The load module format is 0.6. It is additive: the LIR gains four SQL statement tags for dynamic SQL, and its section ends with the files that take their name from a data item, written only when one does. 0.5 stays the oldest format read.

Fixed

  • MAX, MIN, RANGE, REM and SUM returned the winning argument as it was, and no intrinsic function counted in an expression's dmax. They now have as many decimal places as their arguments have at most, counted in dmax (Programming Guide pp. 794, 798-799). With A PIC 9V99 VALUE 1, B PIC 9 VALUE 5 and R PIC 99V9, COMPUTE R = FUNCTION MAX(A B) / 3 * 3 gives 4.9, where it gave 4.8.
  • INTEGER, INTEGER-PART, MOD, REM and ABS carried 31 digits. INTEGER and INTEGER-PART are integer functions one digit longer than their argument, and MOD has the digits of its shorter argument (Language Reference SC27-8713-03, p. 601). Assumptions C390 to C393 record the rules and the two points IBM leaves open, the integer places of MAX and MIN and the precision of ABS.
  • Under --compliance extended, INTEGER of an item with decimal places, and MAX or MIN of items of different sizes, move to an alphanumeric item. The code generator refused the second, and the first could not be moved at all.

Upgrading

  • A program that MOVEs a numeric function is now refused by default. Compute into a numeric item, or run under --compliance extended.
  • An expression holding MAX, MIN, RANGE, REM or SUM can give more decimal places than it did. Expected outputs taken from an earlier release may differ in their last digits.
  • A load module that holds dynamic SQL or an ASSIGN to a data item needs 0.7.0 to run. Every other module 0.7.0 writes reads in 0.5.0 and 0.6.0.
  • A program that ended with an EXEC abend at its first PREPARE or EXECUTE IMMEDIATE now runs the statement, and needs --sql-db or a recording as a static statement does.

Install

ironwork for COBOL 0.7.0. Builds for Linux (static), macOS and Windows, and the npm package @portll/ironwork. The ironwork-tls archives are the same builds with TLS for --sql-db (rustls, sslmode=verify-full). The Python package is on PyPI as ironwork, and the crates are on crates.io. Each file carries SLSA build provenance: gh attestation verify -R Portll/ironwork.