Supported RPG Features

A standalone variable, and any field or subfield with an explicit INZ - or a subfield of a data structure whose header carries INZ - takes its INZ value or its data-type default: character (alphanumeric) to blanks, varying to an empty value, numeric (packed, zoned, integer, float) to zero, and indicators to *OFF.

A data-structure subfield with no INZ (and no header INZ) is not zero-initialized - its storage is blank-filled. A character subfield therefore reads as blanks, and an arithmetic read of a packed or zoned subfield raises a decimal-data error (%STATUS 00907) rather than reading as zero. This holds for every data structure, QUALIFIED / LIKEDS included. Initialize such a subfield - a subfield INZ, a header INZ, or an assignment - before reading it, or trap the error with MONITOR, an (E) extender, or an error indicator.

Overlapping subfields. Subfields may share bytes - via OVERLAY, the POS(n) keyword, or fixed-format from/to positions. Initialization then applies in two stages: every subfield's default is applied first, and the INZ values are applied afterwards in declaration order. So a subfield with no INZ never erases a value that an overlapping subfield's INZ supplied, while two overlapping INZ values resolve in favour of the one declared later:

DCL-DS parts;
  full  CHAR(10) INZ('ABCDEFGHIJ');
  part1 CHAR(3) OVERLAY(full);           // no INZ - leaves 'ABC' standing
  part2 CHAR(3) OVERLAY(full:4) INZ('XYZ');
END-DS;

full reads ABCXYZGHIJ. This holds for both source formats and for either way of placing a subfield.