Sign in

docs RPG Reference

Coding a Compile-Time Array

Coding a Compile-Time Array

A compile-time array is specified using the essential array specifications plus the keyword CTDATA. In addition, on a definition specification you can specify:

  • The number of array entries in an input record using the PERRCD keyword. If the keyword is not specified, the number of entries defaults to 1.
  • The external data format using the EXTFMT keyword. The only allowed values are L (left-sign), R (right-sign), or S (zoned-decimal). The EXTFMT keyword is not allowed for float compile-time arrays.
  • A file to which the array is to be written when the program ends with LR on. You specify this using the TOFILE keyword.

See Figure 1 for an example of a compile-time array.