/**
* \brief Vector Example 2
*
* This example shows how to add more complex data to a vector.
*
*
*
* Every object from the passed library or QGPL will be listed.
* The object name and type are displayed.
*
* \author Mihael Schmidt
* \date 30.01.2009
*
* \param Library name
*/
HDFTACTGRP(*NO)
HACTGRP(*CALLER)
*-------------------------------------------------------------------------
* PEP
*-------------------------------------------------------------------------
D main PR extpgm('VECTOR02')
D library 10A const options(*nopass)
D main PI
D library 10A const options(*nopass)
*-------------------------------------------------------------------------
* Prototypes
*-------------------------------------------------------------------------
/copy VECTOR_H
/copy API_ERR_H
/copy USRSPC_H
/copy QUSLOBJ_H
*
D local_listObjects...
D PR
D vector * const
D library 10A const
*
D local_createUserspace...
D PR *
D usName 10A
D usLib 10A
D usPtr S *
*-------------------------------------------------------------------------
* Data structures
*-------------------------------------------------------------------------
D tmpl_object DS qualified based(nullPointer)
D name 10A
D library 10A
D type 10A
D extAttr 10A
D desc 50A
D userDefAttr 10A
*-------------------------------------------------------------------------
* Variables
*-------------------------------------------------------------------------
D lib S 10A inz('QGPL')
D vector S *
D tmp S 50A
D i S 10I 0
D ptr S *
D entry DS likeds(tmpl_object) based(ptr)
/free
if (%parms() = 1); // library has been passed
lib = library;
endif;
vector = vector_create();
// add spooled files of the current user to the vector
// in form of
local_listObjects(vector : lib);
// display number of entries
dsply %trimr('Number of entries: ' + %char(vector_getSize(vector)));
if (vector_getSize(vector) = 0);
dsply 'No objects in this library.';
elseif (vector_getSize(vector) <= 100);
for i = 0 to vector_getSize(vector) - 1;
ptr = vector_get(vector : i);
dsply %trimr(%trimr(entry.name) + ' (' + %trimr(entry.type) + ')');
endfor;
else;
dsply 'There are more than 100 entries in this library.';
dsply 'Choose a smaller library.';
endif;
// free all allocated memory of the vector
vector_dispose(vector);
*inlr = *on;
return;
/end-free
/**
* \brief List objects
*
* The objects of the passed library are retrieved and put into the
* passed vector. The format of the entry is as follows:
*
*