*OBJ/PARAM |
Parameter Object |
The *obj/param object is used to create, load and maintain an independent object consisting of just the parameters as defined in a Definition File:
oParam=new("*obj/param",pathname$)
Where:
pathname$ is the path to a parameter Definition File. When this object is created, all the parameters defined within the Definition File will be created and initialized within the object.
Once the parameter object has been created, you can load the parameter values by using the 'Load ( ) method as follows:
sts=oParam'Load(pathname$)
Where:
pathname$ is the path to a Settings File whose values will be loaded in the parameter object. A status of 1 is returned if the load was successful; otherwise, this function will return 0.
The 'Edit ( ) method in the parameter object can be used to edit a Settings File:
sts=oParam'Edit(pathname$)
Where:
pathname$ is the path to a Settings File whose values will be presented to allow for editing by the parameter object. The system will use the Definition File that was passed in during object creation. A status of 1 is returned if the edit was successful; otherwise, this function will return 0.
(The Parameter object *OBJ/PARAM was added in PxPlus 2020.)
For this example, suppose that you want a parameter object for the file *win/nomads_properties.txt. (The *win/nomads_properties.txt file is an existing PxPlus system Definition File that was created for the NOMADS Environment Maintenance utility to maintain %NOMADS object properties.)
You could create the object as follows:
oParam=new("*obj/param","*win/nomads_properties.txt")
Suppose you now want to edit these parameters and save them to a file called "MyParam.txt". You would issue the following:
oParam'Edit("MyParam.txt")
This would provide you with a generic parameter maintenance panel to allow you to edit all the parameters as defined in the Definition File "*win/nomads_properties.txt" and to save these in the Settings File "MyParam.txt". If this file already existed, the parameter settings found in this file would be loaded into the maintenance grid.
Once you have a Settings File, you can use the 'Load method to set the values into the object as follows:
oParam'Load("MyParam.txt")