IBM AS/400 Manual de usuario Pagina 148

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 489
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 147
Managing Dynamically-Allocated Storage
*=================================================================
* DYNA_SET: Set an array element.
*
* Function: Ensure the array is big enough for this element,
* and set the element to the provided value.
*=================================================================
P DYNA_SET B EXPORT
*-----------------------------------------------------------------
* Input parameters for this procedure.
*-----------------------------------------------------------------
D DYNA_SET PI
D Element VALUE LIKE(DYNA_TYPE)
D Index 5I 0 VALUE
*-----------------------------------------------------------------
* Local variables.
*-----------------------------------------------------------------
D Size S 10I 0
*-----------------------------------------------------------------
* If the user selects to add to the array, then first check
* if the array is large enough, if not then increase its
* size. Add the element.
*-----------------------------------------------------------------
C Index IFGT NumElems
C EXSR REALLOC
C ENDIF
C EVAL DynArr(Index) = Element
*=================================================================
* REALLOC: Reallocate storage subroutine
*
* Function: Increase the size of the dynamic array
* and initialize the new elements.
*=================================================================
C REALLOC BEGSR
*
* Remember the old number of elements
*
C Z-ADD NumElems OldElems 5 0
Figure 56 (Part 3 of 5). DYNARRAY Subprocedures
124 ILE RPG for AS/400 Programmer's Guide
Vista de pagina 147
1 2 ... 143 144 145 146 147 148 149 150 151 152 153 ... 488 489

Comentarios a estos manuales

Sin comentarios