REFORMAT

Top  Previous  Next

 

The REFORMAT verb constructs a new file from data in the source file. It is of use, for example, when constructing intermediate files in complex reporting processes.

 

REFORMAT {DICT} file.name

{USING {DICT} file.name}

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

{selection.clause}

{sort.clause}

{display.clause}

{record.id...}

{FROM select.list.no}

{TO new.file.name}

 

 

REFORMAT behaves like LIST except that the data identified by the display clause is used to populate a new file instead of being displayed or printed. The first item in the data is used as the record id for the item in the new file. The remaining items form the fields within the record. REFORMAT does not automatically prefix the display clause with @ID.

 

The TO clause can be used to name the target file on the command line. If this clause is not present, a prompt is displayed for the file name. The file must already exist.

 

 

Example

 

REFORMAT CUSTOMERS ZIP.CODE CUST.NO NAME TO CUST.BY.ZIP

 

This command constructs a new file, CUST.BY.ZIP, keyed by zip code and containing two data fields, the customer number and name. Note that if two or more customers share the same zip code, the record will be overwritten by the second and subsequent items.