Figure 1C: Example written in RPG


      * To compile: CRTBNDRPG PGM(EXAMPLE1C)
     H dftactgrp(*no)
     D ptr@            S               *
     D based_data      S             16A   BASED(ptr@)
     D sz              S              5  0 INZ(16)
      /free
        // allocate 16 bytes of storage from the heap
        ptr@ = %ALLOC(sz);

        // set the allocated storage
        based_data = 'abcdefghijklmnop';

        // deallocate storage
        DEALLOC ptr@;

        *inlr = '1';