Lists data from the database.
LIST [ num] [ setspec] [EVALUATE clause ] [FORMAT expression [HEADING expression]] [-> clause]
|num||The number of records to be listed. Num can be
an integer constant (e.g., 15, 200);
a variable, form field, menu item, or formal parameter that evaluates to an integer;
the word ALL.
If num is less than zero, or omitted, num defaults to 1.
|setspec||A set specification whose members are to be listed. If setspec is omitted, the current set (if available) is used.|
|expression||Any expression. Enclose complex expressions in parentheses.|
A character string or an expression that evaluates to a character string.
The LIST command outputs num members of source to the current output device (usually the terminal).
By default, each column has a heading consisting of the field name. Headings can be suppressed using the SET HEADINGS command.
The width of each column is determined by these rules:
- Unless a “LIST width” has been defined, character values occupy a width equal to their defined object length.
- Unless a “LIST width” has been defined, number values are converted to their character equivalents, using the maximum width required for the particular data type (e.g., INT converts to eight characters).
- If defined, the “LIST width” determines the width of a column (if 0 or $Null, the implicit width is used; if -1, the field is not LISTed).
- If headings are to be output, widths are appropriately extended for longer headings.
- If a character-manipulating function reduces the length of values being output, the output width is not reduced.
- The $toalpha and $tocharacter functions can be used to specify the width of a column in LISTed output.
The HEADING option, always used in conjunction with FORMAT, establishes the heading that will be displayed above the corresponding expression, in place of any other heading that ZIM otherwise would be displaying. This option particularly useful whenever the expression is not a single field, thus normally not displaying any headings.
Output is also controlled by the SET PAGESIZE, SET PAGEWIDTH, and SET PAUSE commands.
list all Employees format LName FName (($date – BirthDate)/365)
The complex expression is enclosed in parentheses.
list all Employees format LName heading “LastName” FName(($date-BirthDate)/365)
It will list three fields whose headings are: “Last Name”, “FName” and “Age of Employee”.
The current member of the current set is listed.
list all format $count(“”) LName FName Age
All members of the current set are listed with sequence numbers.