Repository navigation
Releases
v0.9.52
More fixed-format and indicator support, and several rules brought in line with IBM i. Every change was checked against a real IBM i (PUB400). - Data structures: a LIKEDS or LIKE subfield can have DIM, written before or after it. %SIZE of a data structure is its length in bytes (it was the C++ object's size), and CLEAR takes a subfield or an element. - BASED data structures, free and fixed format, with LEN. The indicators are now held as IBM i holds them, '1' and '0', so a data structure based on %ADDR(*IN) gives them names. A pointer's INZ(%ADDR(x)) or INZ(*NULL) is no longer dropped. - The *IN array: *IN(i), *IN = value, CLEAR *IN and %LOOKUP over *IN. - SETON and SETOFF in fixed-format calculations. - An indicator the program refers to but never sets is an error (RNF7030), as on IBM i; so is a fixed-format factor 1, factor 2 or result field that is not left-adjusted (RNF0262). - The RPG cycle: a program whose calculations end with LR off runs them again, as IBM i does. - A called program that returns with a halt indicator on is status 231 in its caller, and rpgc's own halt-indicator message carries RNX0233. The IBM i execution run now builds the programs the tests call, so the CALL tests are compared too: 225 tests give the same output on IBM i. CTL-OPT USRPRF and VALIDATE are not planned; they are accepted and ignored.
v0.9.51
More of fixed-format RPG behaves as it does on IBM i, and two bugs found by the October IBM Ideas portal review are fixed. Each change was checked against a real IBM i (PUB400). - I-spec record identification codes now take the zone (Z) and digit (D) parts of a position, not only the whole character (C). As on IBM i, '&' also matches zone C and '-' also matches zone D. A record belongs only to the first record type it matches; rpgc used to let a later type claim it too. - *ENTRY PARM with factor 2 copies factor 2 into the parameter when the program returns, as IBM i does. rpgc used to refuse factor 2 there. - LIKE(ds.field) defines a field like a qualified data structure subfield. It used to produce an integer field. A LIKE field now starts blank and takes INZ and an initial value. - OVERLOAD now works when its candidates are prototypes declared elsewhere in the source (DCL-PR), not only procedures. OpenRPG extensions IBM i does not accept: LIKE through a nested data structure (ds.sub.field), and OVERLOAD telling an IND argument from a character one.
v0.9.50
Two more behaviours brought in line with IBM i, each found or confirmed
by running programs on a real IBM i (PUB400).
- READ of a program-described file sets on the record identifying
indicator of the record type it identified and turns no other one
off; a READ at end of file changes none. rpgc used to turn off every
other record type's indicator first. This was the cause of the last
two unexplained differences on IBM i.
- MOVE or MOVEL of a character whose EBCDIC digit portion is above 9
('.', '+', '*', '<' and others) into a number is a decimal data error
(status 907) that ends the program unless MONITOR handles it, and the
result field is unchanged. rpgc used to set %STATUS, move zeros, and
carry on.
Upgrading: a program that reads several record types with READ and
relied on rpgc turning the other indicators off must now set them off
itself before each READ, as on IBM i:
C EVAL *IN01 = *OFF
C EVAL *IN02 = *OFF
C READ CUSTFILE
A program that tested %STATUS after such a MOVE now ends at the MOVE;
put it in a MONITOR group.
The IBM i conformance runs log in to PUB400 once per run, retrying when
the machine closes a new connection, and carry on when another job's
output queue survives the library clear.
452 OpenRPG tests, 45 dspfc tests and 31 interactive display-file tests
pass.
v0.9.49
MOVE and MOVEL now behave as they do on IBM i. Each difference was found by running the test programs on a real IBM i (PUB400), and each fix was checked there. - A negative number moved into a character field carries its sign in the zone of the last digit, as a zoned number does: -12345 moves as 1234N, and a last digit of 0 as '}'. The sign used to be dropped. - A character field moved into a number takes the digit portion of each character's EBCDIC (CCSID 37) code, so 'A1 ' moves as 110 with no error; a D zone in the rightmost character (J-R, '}') makes the result negative. Letters used to be status 907. - A MOVE that cannot make a valid date, time or timestamp (status 112), or puts a date outside the result field's format range (114), now ends the program unless MONITOR handles it. It used to set %STATUS and continue. Upgrading: a program that checked %STATUS after a failed date MOVE now ends at the MOVE instead. Put the MOVE in a MONITOR group and test %STATUS in ON-ERROR. MOVE has no (E) extender, on IBM i or here. 450 OpenRPG tests, 45 dspfc tests and 31 interactive display-file tests pass.
v0.9.48
Twenty more features RPG developers asked IBM for -- the second tier of
the IBM Ideas portal's most-voted RPG requests -- and the standard RPG
several of them needed. Every change is checked on a real IBM i
(PUB400): the standard fixes run the same there, and the new features
are OpenRPG extensions that IBM i's compiler rejects.
- %SCANRPL now honours its start and length operands; it used to scan
the whole source. An empty scan string is status 100, as on IBM i (it
looped forever).
- OPTIONS(*TRIM) on a parameter is now applied: the argument arrives
with leading and trailing blanks trimmed. It was parsed and ignored.
- OPTIONS(*OMIT) on a VALUE parameter is now an error (RNF3753), as on
IBM i.
- Growing a DIM(*AUTO) array past its maximum is status 124, as on IBM
i; it was 121.
- %CHAR of %XFOOT of a PACKED array has the array's decimal places
(3.00, not 3.000000).
- %IF(condition : value if true : value if false) (93 votes).
- Keyword arguments: proc(name => 'Ada' : title => 'Dr.') (49).
- %SCANRPL with *FIRST or *LAST (49, and 18).
- OPTIONS(*UPPER) and OPTIONS(*LOWER) on parameters (48).
- CHAR with no length: a string of any length (44).
- INZ(%LIST(...)) on an array (41).
- %XFOOT, %MAXARR, %MINARR and IN over ds(*).subfield (39).
- %COMPCORR(ds1 : ds2 {: n}): compare data structures (38).
- DEPRECATED procedures, with compile-time warnings (35).
- %LOOKUP(%KDS(key) : ds(*)): search on several subfields (34).
- %REPEAT(string : count) (29).
- DEFAULT(value) for *NOPASS and *OMIT parameters (28).
- %PROGNAME (27).
- Binary literals: B'10100001' (26).
- FOR-EACH item IN array INDEX(i) (22).
- A comparison procedure for SORTA and %LOOKUPxx: %PADDR(proc) (22).
- WHEN-IS-NOT and WHEN-NOT-IN (22).
- *EMPTY (16).
- %TOHEX (or %HEX) and %FROMHEX (14).
- /MESSAGE {*WARNING | *ERROR} 'text' (12).
Each is described in docs/GUIDE.md. Source that uses them compiles only
with OpenRPG.
- SELECT with an operand, with WHEN-IS and WHEN-IN (IBM i 7.4/7.5).
- ds(*).subfield in SORTA and %LOOKUP.
- arr(*NEXT) on a DIM(*AUTO) array.
- %BITAND, %BITOR, %BITXOR and %BITNOT of character operands, byte by
byte, and with more than two operands.
- A field or literal passed for an OPTIONS(*OMIT) parameter; only *OMIT
itself could be.
- A procedure with no DCL-PR called before its DCL-PROC.
- The post-release smoke test runs the release's own tests, from its
tag; it used to take main's newer ones.
- The IBM i conformance jobs stop after 60 and 90 minutes; one stalled
on the runner for six hours.
449 OpenRPG tests, 45 dspfc tests and 31 interactive display-file tests
pass.
v0.9.47
Fixes for the four known issues in v0.9.46. Every fix is checked on a real IBM i (PUB400): it gives the same diagnostics, and the programs print the same output. - A %SUBST start or length written as a number must fit the field's declared length, as on IBM i: %SUBST(s : 9 : 5) of a CHAR(10) is now a compile error (RNF0365; a start outside the field is RNF0364). This applies to %SUBST in expressions too. A start or length known only at run time is still checked then (status 100). - %SUBST as an assignment target: %SUBST(s : 2 : 3) = 'XYZ' puts the value into that part of the field, padded with blanks or cut to fit, for a CHAR or VARCHAR field, an array element or a subfield, in free and fixed form. - A name declared twice in one scope is reported by rpgc (RNF3316) instead of failing in the C++ compiler. A procedure's local may still hide a global of the same name. - A call to a name that is no procedure, prototype or array is reported by rpgc (RNF7030) instead of failing in the C++ compiler. - Fixed-format source may open with a compiler directive (/IF, /DEFINE, /COPY) or a /FREE block; it used to be read as free-format. 394 OpenRPG tests, 45 dspfc tests and 31 interactive display-file tests pass.
v0.9.46
Twelve features RPG developers asked IBM for and IBM declined, from the
IBM Ideas portal's most-voted RPG requests, plus fixes for #26 to #29.
Every change is checked on a real IBM i (PUB400): the fixes run the
same there, and the new features are OpenRPG extensions that IBM i's
compiler rejects.
- INT(20) and UNS(20) are 64-bit, and every integer size is range
checked (#26).
- A date plus or minus months or years keeps to the end of a shorter
month: D'2024-01-31' + %MONTHS(1) is 2024-02-29, not 2024-03-02.
- EXEC and SQL must be on the same line, as on IBM i (the statement
itself can still start on the next line).
- The SQLCA has no SQLERML; use SQLERRML or SQLERL, as on IBM i.
- Block comments: /* ... */, in free-form and fixed-form source (93 votes).
- Display files defined in JSON: `dspfc screen.json`, in the shape of
the .dspfd descriptor (90 votes).
- %FKEY: the function key that ended the last EXFMT or READ (40 votes).
- Several names in one DCL-S: DCL-S i j k INT(10); (39 votes).
- Interpolated strings: f'I have {apples} apples' (37 votes).
- Procedures inside procedures, seeing the outer one's variables
(30 votes).
- NOT IN (30 votes).
- Regular expressions: %MATCHES, %FIND, %COUNTMATCHES (28 votes).
- CTL-OPT OPTION(*NOLENCHK): a %SUBST length past the end gives the
rest of the data (27 votes).
- %CHAR(number : *NOZEROSUPPRESS) keeps leading zeros (25 votes).
- AND, OR, NOT and parentheses in /IF and /ELSEIF (15 votes).
- *TRUE and *FALSE (13 votes).
Each is described in docs/GUIDE.md. Source that uses them compiles only
with OpenRPG.
- INZ(*ON) on an indicator starts it on (#27).
- Adding or subtracting a duration moves a timestamp, in every unit;
subtracting a duration from a date or time compiles (#28).
- An indicator is character data, '1' or '0': 'flag=' + flag, c1 = flag
and flag = '1' all compile (#29).
- x IN array compiles, for fixed and varying arrays.
- A procedure can return IND.
- In free-form source, an /ELSEIF after an /IF that was not taken is
tested; its /ELSE used to run instead.
Found while working on this release, and not yet fixed:
- A name declared twice with DCL-S, and a call to a procedure that does
not exist, are reported by the C++ compiler rather than by rpgc.
- %SUBST as the target of an assignment is a syntax error.
- Fixed-form source whose first line is a directive such as /IF is read
as free-form.
383 OpenRPG tests, 45 dspfc tests and 31 interactive display-file tests
pass.
v0.9.45
Program calls now find the called program when they run, as on IBM i
(#23), and the runtime compiles without GCC warnings (#19). These changes
have not yet been checked on a real IBM i, because PUB400 is down.
Behaviour changes to be aware of
- Every program call (CALLP of an EXTPGM prototype, or CALL) is resolved
at run time from a shared library. Callers no longer link a called
program's object file. Build each called program with the new
rpgc -shared ORD100.rpgle, which produces ORD100.so, ORD100.dylib or
ORD100.dll, named after the source file, and put it next to the caller
or on PATH. A called program written as a NOMAIN module needs to become
a program: give it an *ENTRY PLIST, or DCL-PI *N in free form.
New
- Dynamic program calls (#23):
rpgc -sharedbuilds a program that others call.- EXTPGM(variable) and CALL with a field in Factor 2 choose the program
at run time. EXTPGM with no name means the prototype's own name. - The program is looked for in the caller's directory, then on PATH,
then wherever the system loader looks. It is loaded on its first call. - A program that can't be found is status 211. One that ends in error is
status 202 in its caller. CALLP(E) now reports an error's own status. - Parameters are passed in IBM i's formats (CHAR as bytes, INT as a
native integer, PACKED as packed decimal, ZONED as digits), so a
called program can be written in C, or be a GnuCOBOL module.
- Free-form programs can receive parameters, with
DCL-PI *Namong the
main statements.
Fixes
- GCC no longer warns about the runtime on any compile (#19). Numbers are
now formatted into strings sized to fit, which also fixes %CHAR of very
wide decimal fields being cut short. The display-file runtime gets the
same fix. - Windows: an SQL program with a field named MSG compiles (also in v0.9.44).
Known issues
Found while testing this release, and not yet fixed: #26 (INT(20) is 32-bit),
#27 (INZ(*ON) on an indicator is ignored), #28 (adding a duration to a
timestamp leaves it unchanged), and #29 (an indicator can't be concatenated
to a character value).
349 OpenRPG tests, 39 dspfc tests and 28 interactive display-file tests pass.
v0.9.44
v0.9.43 plus one Windows fix. The v0.9.43 Windows x64 installer was not
built because its test suite stopped on this bug; this release includes it.
Fixes
- Windows: an SQL program with a field named MSG compiles. The SQL
runtime's <windows.h> also declared the window manager's MSG structure,
so the C++ compile failed with "reference to 'MSG' is ambiguous". This
failure existed before v0.9.43; test335 exposed it.
For everything else in this release, see the v0.9.43 notes: fixes for the
issues reported against v0.9.42, commitment control for embedded SQL,
EXTFILE/OPEN/CLOSE, free-form DCL-F DISK(n), GET DIAGNOSTICS MESSAGE_TEXT,
halt indicators and the exit status.
v0.9.43
This release fixes the 24 issues reported against v0.9.42 (#1-#22, #24, #25).
These changes have not yet been checked on a real IBM i, because PUB400 is
down. A conformance run will follow when it is back.
Behaviour changes to be aware of
- Embedded SQL runs under commitment control, as CRTSQLRPGI's default
COMMIT(*CHG) does on IBM i. Each change waits for COMMIT, and ROLLBACK
now undoes it; before, every statement was committed as it ran.
Changes still pending are committed when the program ends normally or
at DISCONNECT, and rolled back when it ends in error.EXEC SQL SET OPTION COMMIT = *NONE;turns commitment control off (#2). - SQLCODE is the code Db2 for i gives for the SQLSTATE, for example
-204 for a missing table or -803 for a duplicate key, not the driver's
native error number negated. An SQLSTATE with no Db2 equivalent keeps
the native number (#22). - A NULL fetched into a host variable that has no null indicator is
SQLCODE -305 / SQLSTATE 22002, and the variable keeps its value (#25). - A USROPN file is opened by OPEN. Before, USROPN was ignored and the
file opened itself. Any other operation before OPEN is status 1211 (#20). - In fixed-form source, a free-form statement outside /FREE (positions
6-7 blank, code in 8-80) is now compiled. These lines used to be
dropped without a message (#21). - Calls are checked against the prototype (RNF7535). An argument of
another type, or a non-variable passed to a parameter passed by
reference, is now an rpgc error instead of a C++ compile error. A
subfield of a CONST parameter can't be assigned (#17).
New
- EXTFILE('path') and EXTFILE(var) choose the file a program-described
file opens. OPEN, CLOSE, CLOSE *ALL and %OPEN, with the E extender (#20). - Free-form
DCL-F name DISK(n)declares a program-described file, and
USAGE(*INPUT:...)now parses (#21). - GET DIAGNOSTICS CONDITION 1 with MESSAGE_TEXT, MESSAGE_LENGTH,
RETURNED_SQLSTATE, DB2_RETURNED_SQLCODE and DB2_MESSAGE_ID, and the
SQLCA's SQLERRMC and SQLERRML (#22). - Exit status: halt indicators *H1-*H9 end the program in error with
status n.rpg_set_exit_status(an OpenRPG extension called through an
EXTPROC prototype) sets a status for a normal end (#24). - Unnamed data structures:
DCL-DS *N, and a fixed-form DS with a blank
name (#15). - A data structure can be used as a character value: DSPLY, assignment,
concatenation, comparison and the string built-ins (#13). - %INT, %DEC, %FLOAT and the other numeric conversions take a character
operand (#8). - Data structure subfields can be SQL host variables, written as
:ds.subor as:subfor a DS that isn't QUALIFIED (#6).
Fixes
- Fixed-form subfields that share From/To positions now share storage (#5).
- TEST(DE) takes a qualified subfield or an array element (#7).
- INZ(*SYS) on a fixed-form D-spec (#9).
- Subroutines in a subprocedure: an EXSR before the BEGSR now
compiles (#10). - OVERLAY subfields can be read through a LIKEDS parameter or a LIKEDS
subfield (#16). - EXEC SQL can be followed by a line break (#18).
- Fixed earlier, after v0.9.42 shipped: RETURN in a subroutine (#1);
%EDITC and O-spec edit code lengths and alignment (#3, #4); a DS
declared in a DCL-PROC (#11); SND-MSG *ESCAPE from the main procedure
(#12); INZ on a DS or a subfield (#14). The g++ format-truncation
warning (#19) came from code that was replaced, so it should be gone.
343 OpenRPG tests and 28 interactive display-file tests pass. A test can
now name its expected exit status in testN.exit, and error tests must be
rejected by rpgc itself, not by the C++ compiler.