reformat

reformat


r Index Level relational operators
Syntax reformat file.reference {sellist} {itemlist} outlist {modlist}
filename:destination-file or tape<return>  
Category Access
Type Verb
Description takes values from the attributes specified in the command and places them either in another file or to magnetic media in the order in which they are presented.

The specific items to be selected are included in the "itemlist".

If no "itemlist" is specified, all items in the file are selected in order by the group into which they hash, and within groups, in the order they were added to the file. The items are written to the new file or tape in the order in which they are selected.

The output specifications indicate those attributes that are to be selected.

The source item-id is selected first and becomes the destination item-id unless id-supp is specified. In that case, the first attribute value becomes the new item-id. Subsequent attributes are placed in the new item in the order they are specified.

"reformat" requests the destination file.reference. To send the output to a file, enter the file.reference. To send the output to magnetic tape, enter the word "tape". To write the output back onto the source file, press <return> or <enter>.

If the items are to be written back to the source file, an itemlist must be specified or a list must be active, otherwise, an infinite loop condition may result, in which items are continually added to the file!

When a file is reformatted to tape, the values are concatenated and either truncated or padded at the end with nulls (hexadecimal 00) to the record length specified by the most recently executed "t-att" verb. One tape record is written for each item.

item-ids are printed as items are dumped, unless the "id-supp" connective, or "i" option, is specified.

A tape label, which contains the file.reference, tape record length in hexadecimal, time, and date, is written on the tape first, unless the "hdr-supp" or "col-hdr-supp" connectives ("h" or "c" options) are specified. Two end-of-file (EOF) marks terminate the tape.

Any processing code that refers to a selected attribute is applied before the item is written to the new file or tape.
Options see "options: Access (Access: Verbs)"
See Also options: itemlist outlist modlist sreformat col-hdr-supp t-att Access verbs
Example reformat entity a0 name phone
File Name   :? entity-new

This takes all items from the "entity" file and writes them to the "entity-new" file, using the temporary attribute-defining item reference of "a0" to use the same item-id's in both files. The data in "entity-new" will contain the "name" in attribute one and the "phone" number in attribute two.
Warnings The destination item is usually non-existent. "reformat" to an existing item has different results in D3 than it did in R83.

In D3 and R83, if the targeted attribute is null, the new value is placed there. If the targeted attribute is non-null, on R83, the attribute is overwritten; in D3, a new value is added to the end of the attribute.  Using the O-option will make D3 behave like R83.

Be careful! Items can overwrite themselves on the same file, destroying the originals!
Compatibility D3 7.0 AP R83
r Index Level relational operators