sreformat command

The sreformat command moves the sorted values from the attributes specified in the AQL sentence and places them either in another file or to tape in the order of the specified sort key (specified in sort.criteria).

Syntax

sreformat file.reference {item.list} {selection.criteria} {sort.criteria}
{output.specification} {modifiers} {options}
filename: {destination-file|tape}

Parameter(s)

options o Overwrites existing items, when a duplicate item-ID exists.

Description

If the targeted attribute is null, the new value is placed there. If the targeted attribute is nonnull, a new value is added to the end of the attribute. To overwrite the attribute in D3, use the o option.

Each entry in the output.specification becomes an attribute in the destination item, in the same order as in the output.specification. The source item-ID is selected first and becomes the destination item-ID, unless id-supp (or an i option) is specified. In this case, the first attribute value becomes the new item-ID. Upon execution of this command, the prompt below displays:

file name:

Either a file reference that directs the output to the specified file reference, or the literal tape that directs the output to the attached magnetic tape can be entered.

The output specification indicate the attributes that are to be selected. The attributes are written to the new file or tape in the order they are selected.

Note: >To write the output back to the source file, press ENTER. If the items are to be written back to the source file, an item list must be specified or a list must be active. Otherwise, an infinite loop condition can 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 command. One tape record is written for each item. The item-IDs are printed as items are not printed as the items are transferred.

A tape label containing the file name, tape record length in hexadecimal, time, and date, is written 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 (or correlative) that refers to a selected attribute is applied before the item is written to the destination file or tape.

Warning:
  • sreformat to an existing item produces different results in AP than it does in 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 AP, a new value is added to the end of the attribute. To overwrite the attribute in Advanced PICK, use the o option.

Example(s)

sreformat sls by region region total amount (d
filename: temp-sales