NAME

pquery2 - Query a parameter value for a specified tool or parameter file.

USAGE

pquery2 [ -f ] tool-or-par-file-name parameter-name [ command line arguments ]

DESCRIPTION

pquery2 displays on standard output the value of the specified parameter (parameter-name) for a specified task or parameter file. If a value assignment for parameter-name is listed in the optional [ command line arguments ], the displayed value is taken from that assignment; if not, a query is generated on standard error for the parameter. In either case, the new value of the parameter (as long as it is not a "hidden" parameter) is updated in the parameter file for that task (see pquery for alternate behavior: pquery will update both hidden parameters and non-hidden parameters).

pquery2 is typically used in scripts which invoke other tasks that utilize parameter files. For example, a script may take as input a series of parameter assignments which are then passed to one or more pquery2 calls within the script to retrieve the values of various parameters. Any (non-hidden) parameters not given a value when invoking the script will then be queried for.

   if (`pquery2 script-name par1 $*` == "yes") then
      ...
      ...
   endif
In this example, if the user runs the script (named "script-name") and specifies the value of the "par1" parameter on the command line, i.e.

   % script-name par1=yes
then no query will be generated for the value of "par1".

Behavior of this task depends upon the value of the PFILES environment variable, which is used to specify the location of parameter files. The PFILES variable uses a semicolon delimiter to separate two types of parameter directories:

     <user>;<system>
The first path ("user") is one or more "local" (writeable) parameter directories (typically $HOME/pfiles for a default HEASoft setup), and the second path ("system") is one or more read-only parameter directories (typically $HEADAS/syspfiles). When both paths are equivalent, one may omit the semicolon and duplicate path (for example, when developing a new task, one might set PFILES="." to use only the current working directory). Multiple colon-delimited directories are allowed in both portions of the PFILES variable:

     <user1>:<user2>;<system1>:<system2>
The default values from the first "system" path are used the first time a task is run, or whenever the default values have been updated more recently than the user's copy of the parameters. The user's copy is created when a task terminates, and retains any learned changes to the parameters.

This task will look for a copy of the specified parameter file (or parameter file for the specified task) in the first "user" parameter directory; if the file does not exist there, it will then search all subsequent directories listed in PFILES.

The "-f" flag may be used to disable searching of directories listed in the PFILES variable, allowing instead for specification of a particular parameter file (with a preceding directory path if the file is not in the current working directory).

EXAMPLES

1. Query the numerrs parameter for the task 'ftverify':

   % pquery2 ftverify numerrs
   number of errors (output) [0] 
   0
2. Query the numerrs parameter for the task 'ftverify', using the command line to specify the value:

   % pquery2 ftverify numerrs numerrs=0
   0
3. Query the numerrs parameter for the task 'ftverify', disabling the default search of directories listed in PFILES and instead providing the path to a specific parameter file:

   % pquery2 -f /local/data/test/ftverify.par numerrs numerrs=0
   0

SEE ALSO

pquery, pget, plist, pset, punlearn

LAST MODIFIED

Aug 2016