H dftactgrp(*no) actgrp(*caller) H bnddir('MY_BND_DIR') *--------------------------------------------------------------- * Prototypes *--------------------------------------------------------------- /copy GLIB_H *--------------------------------------------------------------- * Datastructures *--------------------------------------------------------------- D glist DS qualified based(tmpl_ptr) D data * D next * D prev * *--------------------------------------------------------------- * Variables *--------------------------------------------------------------- D listPtr S * inz(*null) D list DS likeds(glist) based(listPtr) D ptr S * D var S 40A based(ptr) D tmpPtr S * D tmpDS DS based(tmpPtr) likeds(glist) D tmp S 40A /free // create entry and add it to the list ptr = %alloc(100); var = 'Mihael Schmidt 1'; listPtr = g_list_append(listPtr : ptr); // create second entry and add it to the list ptr = %alloc(100); var = 'Mihael Schmidt 2'; listPtr = g_list_append(listPtr : ptr); // display the length of the list (should be 2) dsply %trimr('List length: ' + %char(g_list_length(listPtr))); // get the first entry of the list // not the value but a data structure with the value will be returned tmpPtr = g_list_first(listPtr); tmp = %str(tmpDS.data); dsply tmp; // free the memory allocated by the list g_list_free(listPtr); // the memory allocated for the values must be freed by one self dealloc(n) ptr; dealloc(n) tmpPtr; *inlr = *on; return; /end-free