Supported RPG Features

The fixed-format ALLOC opcode allocates heap storage and sets a basing pointer:

     D pBuf            S               *
     D wBuf            S             20A   BASED(pBuf)
     C                   ALLOC     20            pBuf
     C                   EVAL      wBuf = 'Hello'

Factor 2 is the byte length to allocate. The result field is the basing pointer variable. The (E) operation extender enables error trapping via %ERROR/%STATUS (status 00425 for length out of range, 00426 for allocation failure). Alternatively, an ER resulting indicator (columns 73 - 74) can be specified.