LIST and SORT

LIST and SORT

Top  Previous  Next

 

The LIST and SORT verbs produce reports from QM files. The LIST verb displays records in the order in which they are encountered in the file unless a sort clause in present in the command. The SORT verb is equivalent to LIST with a final sort by record id.

 

LIST {DICT} file.name

{USING {DICT} file.name}

{field.name {field.qualifier} ...}

{selection.clause}

{sort.clause}

{display.clause}

{record.id...}

{FROM select.list.no}

 

SORT {DICT} file.name

{USING {DICT} file.name}

{field.name {field.qualifier} ...}

{selection.clause}

{sort.clause}

{display.clause}

{record.id...}

{FROM select.list.no}

 

 

The record id is always reported as the first item in the output unless the ID.SUP keyword has been used to suppress it. The format of this item is determined by the @ID dictionary record. If this record is not found in the dictionary, a default format is used.

 

If field names are specified in the command, these fields are displayed in the order specified. If no field names are present, the query processor looks for a phrase in the dictionary defining a default set of fields to be reported. If the LPTR keyword has been included, the query processor first looks for a phrase record named @LPTR. If this cannot be found or the LPTR keyword was not used, it looks for a phrase record named @. The @LPTR and @ phrases can be used to create separate default field name lists for output to the printer and the display respectively. If no @LPTR or @ record is found, only the record id is reported.

 

The default listing phrase may include field qualifiers, selection, sort and display clause items.

 

The LIST and SORT verbs normally produce a tabular format report with items listed side by side. If the total width of the items to be reported exceeds the width of the display or printer to which the report is directed, a vertical format report is produced. This can be forced by use of the VERTICALLY keyword.

 

The PAN keyword allows reports wider than the display to be produced using the left and right cursor keys to pan part or all of the displayed data.

 

The SCROLL keyword allows scrolling back and forward using the up and down cursor keys.

 

When LIST or SORT are used to list a dictionary with the no display clause, the action of the default listing phrase (@), includes transformation of A and S-type dictionary items into a form that maps onto the standard dictionary display format used for other types.

 

 

Example

 

LIST STOCK QTY REORDER.LEVEL WITH QTY < REORDER.LEVEL

 

This command lists all records from the STOCK file for which the quantity in stock (QTY field) is less than or equal to the reorder level (REORDER.LEVEL field). These two fields are displayed together with the record id.