       IDENTIFICATION DIVISION.
       PROGRAM-ID. DEMO-ALLOCATE.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 MY-POINTER USAGE POINTER.

       LINKAGE SECTION.
       01 MY-TABLE BASED.
           05 ITEM OCCURS 3 TIMES.
              10 NAME PIC X(20).
              10 AGE  PIC 99.

       PROCEDURE DIVISION.
       MAIN-LOGIC.
           ALLOCATE MY-TABLE INITIALIZED RETURNING MY-POINTER

           IF MY-POINTER = NULL
               DISPLAY "Allocation failed"
               STOP RUN
           END-IF

           SET ADDRESS OF MY-TABLE TO MY-POINTER

           MOVE "Alice" TO NAME(1)
           MOVE 25     TO AGE(1)

           DISPLAY "Name: " NAME(1) " Age: " AGE(1)

           FREE MY-POINTER
           SET MY-POINTER TO NULL

           STOP RUN.
       END PROGRAM DEMO-ALLOCATE.
