Supported RPG Features

A PRINTER file declared without a record length is externally described: its record formats come from a printer DDS, and WRITE <format> prints that record. A record length is what makes a printer file program-described instead - PRINTER(132) in free format, a length in F-spec columns 23 - 27 in fixed format.

**FREE
dcl-f QPRT2 printer;              // no length -> externally described
custnm = 'ACME CORP';
amount = 42.50;
write DTLREC;                     // a record format, not the file name
     FQPRT2     O    E             PRINTER
     C                   EVAL      CUSTNM = 'ACME CORP'
     C                   EVAL      AMOUNT = 42.50
     C                   WRITE     DTLREC

Supply the printer DDS as a .prtf file named after the printer file, found beside the RPG source or under --dds-path. The fields it names become program fields, exactly as for an externally-described disk file, so the calculations above can assign to them before the WRITE:

     A          R DTLREC
     A                                  1  2'NAME:'
     A            CUSTNM        20A     1  8
     A            AMOUNT         7S 2   1 30

Each element prints at its declared line and print position - the line number in DDS columns 39 - 41, the position in 42 - 44. A character field is blank-padded to its declared length; a numeric field prints its zoned digit image, zero-filled to its declared precision with no decimal point, so AMOUNT holding 42.50 in a 7-digit field prints 0004250, not 42.50. A record whose elements span several DDS line numbers prints that many physical lines, in line order.

Keywords beyond the placed constants and fields are read past rather than rejected, so a DDS carrying editing or indicator keywords still yields a usable layout - but only the placement above is honored.