show_keys can list the keyword names and values, and the segment names and file names (full paths) for each record in a record set. It can also list the full path to the record direcory in SUMS, which contains the segment files. Exactly what information gets printed is controlled by command-line flags (see below). The -k flag controls the format of the output. If it is set, then the output is in table format, with a header row showing the keyword names. Otherwise, keyword name=value pairs are listed one per line. If the -a flag is set, show_keys lists the names of all series keywords, prime keywords, and segments, and exits. Otherwise, it prints keyword and segment information as specified by the other flags and arguments. If the -p flag is set and seglist is specified, then the full paths for the segment files will be displayed. If the -p flag is set, but seglist is not specified, then only the full path to the record's storage unit will be displayed.
The number of records for which information will be printed must be specified, either by supplying a record_set string that selects a subset of records from a series, or by supplying the n=nrecords argument, which indicates the number of records.
show_keys [-aklpqrDRIVER_FLAGS] ds=<record_set> [n=<nrecords>] [key=<keylist>] [seg=<seglist>]
Example: To show the storage-unit paths for a maximum of 10 records:
show_keys -p ds=su_arta.TestStoreFile n=10
Example: To show information, in non-table format, for all keywords, plus the segment named file_seg, for a maximum of 10 records:
show_keys ds=su_arta.TestStoreFile -akr n=10 seg=file_seg
-a: Show all keyword names and values for each record specified by record_set or nrecords. -a takes precedence over keylist. -k: List keyword name=value pairs, one per line. Otherwise print all keyword values on a single line and print a header line containing the keyword names (table format). -l: List the names of all series keywords, prime keywords, and segments, and exit. Otherwise, print keyword and segment information as specified by the other flags and arguments. -p: Include in the output the full storage-unit path for each record -q: Quiet - omit the header line listing keyword names if the -k flag is set -r: Include in the output the record number keyword| record_set | A series name followed by an optional record-set specification (i.e., seriesname[RecordSet_filter]). Causes selection of a subset of records in the series. This argument is required, and if no record-set filter is specified, then n=nrecords must be present. | |
| nrecords | nrecords specifies the maximum number of records for which information is printed. If nrecords < 0, show_keys displays information for the last nrecords records in the record set. If nrecords > 0, show_keys displays information for the first nrecords records in the record set. If record_set contains a record set filter, then nrecords can reduce the total number of records for which information is displayed. | |
| keylist | Comma-separated list of keyword names. For each keyword listed, information will be displayed. keylist is ignored in the case that the -a flag is set. | |
| seglist | Comma-separated list of segment names. For each segment listed, the full path to the segment's file is displayed (if the -p flag is set) or the file name of the segment's file name is displayed (if the -p flag is unset). |
Variables | |
| ModuleArgs_t | module_args [] |
| Global DRMS-module structure representing the default command-line arguments for a DRMS module. | |
| char * | module_name = "show_keys" |
| Global DRMS-module string providing the name of the module. | |
Initial value:
{
{ARG_STRING, "ds", "Not Specified", "<record_set query>"},
{ARG_STRING, "key", "Not Specified", "<comma delimited keyword list>"},
{ARG_STRING, "seg", "Not Specified", "<comma delimited segment list>"},
{ARG_FLAG, "a", "0", "Show info for all keywords"},
{ARG_FLAG, "h", "0", "help - print usage info"},
{ARG_FLAG, "l", "0", "just list series keywords with descriptions"},
{ARG_INT, "n", "0", "number of records to show, +from first, -from last"},
{ARG_FLAG, "p", "0", "list the record\'s storage_unit path"},
{ARG_FLAG, "P", "0", "list the record\'s storage_unit path but no retrieve"},
{ARG_FLAG, "k", "0", "keyword list one per line"},
{ARG_FLAG, "q", "0", "quiet - skip header of chosen keywords"},
{ARG_FLAG, "r", "0", "recnum - show record number as first keyword"},
{ARG_END}
}
module_args, a global array of ModuleArgs_t structures, provides a standard mechanism for declaring the parameters expected to be used by a module along with their types and default values, if any. module_args must be declared in every module. The elements of the module_args array are parsed and compared with arguments supplied to the module from the command line or other invocation to produce a CmdParams_t structure (cmdparams) through which their values are available through the params_get suite of functions.
The module_args declarator requires at least one element, which must be of type ARG_END (which is 0, so an empty initializer as shown in the synopsis is acceptable). Any array elements following the ARG_END element are ignored.
Although the default value (and range, if applicable) is supplied as a character string, it will be interpreted according to the declared type of the argument. Each element of cmdparams, except those of type ARG_VOID, must have a name field. Arguments of type ARG_INT, ARG_FLOAT, ARG_DOUBLE, and ARG_STRING should be self-explanatory. Arguemts of type ARG_FLAG are expected to have single-character names and to be associated with logical binaries, with a default value of FALSE (0); they can be set on the command line via the -X construct (where X is the name of the element to be set to TRUE). ARG_TIME is a special case of ARG_DOUBLE, whose default or assigned values are interpreted by sscan_time (q.v.). ARG_VOID is reserved for use with undeclared arguments supplied on the command line; it should not be used for declared arguments in the module_args list.
The types ARG_INTS, ARG_FLOATS, and ARG_DOUBLES are used for parameters that can be arrays of arbitrary length. The values must be supplied as comma separated sets enclosed within matched delimiting pairs of either brackets [], braces {} or parentheses () (unless there is only one value in the array, in which case the delimiters are optional). The total number of elements in the array is returned as the added parameter name_nvals, and the value for the nth element (counting from 0) as name_n_value. For example, a @ module_args element declared as:
{ARG_FLOATS, "lat", "[0.0, 5.0, 10.0]", "", ""},
would return 3 for params_get_int (params, "lat_nvals") and the value 5.0 for params_get_float (params, "lat_1_value"). The number of array values supplied at run time need not match the number in the default; indeed there is no necessity of setting any default value at all, just as with other types of arguments.
ARG_NUME is a special type of argument representing an enumeration class. It makes use of the module_args->range field, which must be a comma-separated list of strings. The value returned is an integer coresponding to the order number of the range element matching the supplied value. For example, a module_args element declared as:
{ARG_NUME, "color", "green", "", "red, yellow, green, blue"},
would return 2 for params_get_int (params, "color"). A failure occurs if the value supplied does not match anything in the range; the type is designed especially for use with driver programs that can provide menus of options, such as CGI forms.
ARG_DATASET and ARG_DATASERIES are special cases of ARG_STRING reserved for names of DRMS dataset specifications or series names in an environment where the database can be queried for possible values; they are not currently treated differently from any other type of string argument.
ARG_NEWDATA does not appear to be implemented; ARG_NUMARGS is reserved for internal use by the Fortran interface and should not be used.
To summarize, ModuleArgs_t->type must have one of the following values:
| ARG_INT | parameter is to be interpreted as type int |
| ARG_FLOAT | parameter is to be interpreted as type double |
| ARG_DOUBLE | parameter is to be interpreted as type double |
| ARG_TIME | parameter is to be interpreted as type double, with a conversion from standard date-time string formats to a standard reference epoch |
| ARG_STRING | parameter is to be interpreted as type char* |
| ARG_FLAG | the parameter is (ordinarily) a single-character named one which can take the value of 0 or 1. The default value, if present, should be 0; as the command-line flag specifier can only set its parameter values to 1; however, it is better to leave the default value empty, so that the cmdparams_exists function can be used in the code. |
| ARG_NUME | the parameter value is string-compared with the members of the module_args->range list, and replaced with the string representation of the number corresponding to the order number of the (first) matching token in the list; its value is subsequently to be interpreted as type int. Basically equivalent to type enum |
| ARG_INTS | (not yet implemented) |
| ARG_FLOATS | (not yet implemented) |
| ARG_DOUBLE | synonymous with ARG_FLOATS |
| ARG_VOID | (not yet implemented) |
| ARG_END | signals the end of the parsed argument list. Elements may follow in the declaration, but will be ignored. Since ARG_END is defined as 0, an empty (null) member serves the same purpose. |
The module_args->description is intended to be used only by the front-end handler for documentation, such as when the command is invoked with a -H help flag, or in CGI web forms.
Definition at line 120 of file show_keys.c.
1.5.4