/** * \brief Property files : Simple example * * This example shows how to load properties from a file and iterate * over all entries. * * \author Mihael Schmidt * \date 06.05.2011 */ *------------------------------------------------------------------------- * PEP *------------------------------------------------------------------------- D main PR extpgm('PROPEX01') D main PI *------------------------------------------------------------------------- * Prototypen *------------------------------------------------------------------------- /include 'properties_h.rpgle' /include 'arraylist_h.rpgle' *------------------------------------------------------------------------- * Variablen *------------------------------------------------------------------------- D properties S * D keys S * D dsp S 50A D i S 10U 0 /free properties = properties_load( '/home/iusr0001/src/properties/examples/manifest.mf' : ':'); dsply properties_size(properties); // check for a specific entry if (properties_contains(properties : 'Bundle-Version')); dsply 'jap. version'; dsp = properties_get(properties : 'Bundle-Version'); dsply dsp; else; dsply 'nope. version'; endif; // iterate over all entries keys = properties_list(properties); for i = 0 to arraylist_getSize(keys) - 1; dsp = 'Key: ' + arraylist_getString(keys : i); dsply dsp; endfor; // clean up properties_finalize(properties); *inlr = *on; return; /end-free