Supported RPG Features

Triton RPG supports the conditional-compilation directives in both fixed-format and free-format source. Directive keywords are case-insensitive.

Directive Behavior
/DEFINE name / /UNDEFINE name Add or remove a compile-time condition name.
/IF DEFINED(name) / /IF NOT DEFINED(name) Include the following lines only when the condition holds.
/ELSEIF ... / /ELSE / /ENDIF Alternative and default branches; closes the /IF group. Nesting is supported to any depth.
/EOF Stop reading the current source member: everything after /EOF in that member is excluded from compilation.
/EJECT / /SPACE / /TITLE Listing-only directives; accepted and ignored (they have no effect on generated code).

/EOF scope: /EOF terminates only the member it appears in. Inside a /COPY member, it discards the rest of that member while the parent source continues after the /COPY; at the top level, it discards the rest of the file. Lines after /EOF are not parsed, so they need not be valid RPG. /EOF also closes any /IF group that was opened while reading the current member, so the include-guard pattern works as on IBM i:

      // Guard a copy member against being included twice
      /IF DEFINED(MYCOPY_INCLUDED)
      /EOF
      /ENDIF
      /DEFINE MYCOPY_INCLUDED
     D MyField         S             10A

A /EOF that falls in an excluded /IF branch has no effect.