REFORMAT Command

The REFORMAT command restructures file items and sends output to another file, or backup medium. The output can also be directed back to the original file specified in the INFO/ACCESS query.

Format

REFORMAT [DICT] filename [item-list] [selection] [output] [print] [modifiers] [(options)]

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

item-list

List of individual item-IDs. Enclose each item-ID in single quotes.

selection

Specifies one or more conditions that an item must meet to be transferred. For a complete description of selection expression syntax, see the LIST Command.

output

List of attribute-names whose values are to be transferred. If you do not include this parameter, the REFORMAT command transfers only item-IDs. You can also specify a phrase.

print

Specifies which values from MultiValued attributes will be transferred. Use relational operators and values immediately following the name of the MultiValued attribute.

modifiers

Include one or more keywords that specify the report format. These parameters affect headers, footers, spacing, and more. For complete information about using these keywords, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

options

Include one or more single-character codes that specify the report format and direct or modify output. They must be enclosed in parentheses, can be entered in any order, and need not be separated by spaces or any delimiters such as commas. For complete information about using these parenthetical options, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

Description

The contents of any attribute in the original file can be made the item-IDs for the items in the restructured destination file. This is useful for creating a new file that consists of a subset of the attributes in an existing file. The values that are to be made into item-IDs must be unique, however. A null or any other set of identical values will become the item-ID of one item, and the data in those items will be stored as MultiValues in the item in the destination file.

After the REFORMAT command is entered with accompanying parameters, the system displays the following prompt:

FILE NAME:

At this point, you can perform one of three different operations:

  1. Transfer items to backup media. You must have already attached the tape unit, or floppy disk, and set the record length with T-ATT.

  2. Transfer items to another file.

  3. CAUTION

    Use the REFORMAT command with care! Most INFO/ACCESS commands generate reports without altering the actual data stored in a database. REFORMAT, however, is an exception, since it can create new file items and alter existing file items.

Restructuring File Items

The following example builds a new file, PHONE-LIST, to contain a subset of the information in the CUSTOMERS file. The customer’s telephone numbers, which are stored in Attribute 6 of CUSTOMERS, become the item-IDs of the items in PHONE-LIST, and the first name and last name are the first and second attributes of each PHONE-LIST item.

>REFORMAT CUSTOMERS PHONE FIRST-NAME

   LAST-NAME ID-SUPP

 

FILE NAME: PHONE-LIST

 

>COPY DICT CUSTOMERS 'FIRST-NAME' 'LAST-NAME'

TO: (DICT PHONE-LIST)

 .

 .

 .

Since FIRST-NAME and LAST-NAME are Attributes 1 and 2 (respectively) in both the old and the new files, there is no need to edit the Attribute Definition items of the PHONE-LIST dictionary.

Creating a Cross-Reference File

The following example shows how to use REFORMAT to create a cross-index to a CUSTOMERS file. The original CUSTOMERS file uses a special unique code for its customer IDs. By reformatting the data in CUSTOMERS, you can build a new file, CUSTNAMES, that uses the customer’s last names as item-IDs.

>LIST CUSTOMERS LAST-NAME FIRST-NAME

 

 

 

PAGE 1

12:46:37  dd mmm yyyy

CUSTOMERS...

Last Name ...

First Name

 

 

 

HJENK1222M

JENKINS

HAROLD

SPIRS112A

PIRS

SANDRA

AJOHN760JE

JOHNSON

ALICE

BLEAR34TRE

LEARY

BILL

JBOHA126TR

BOHANNON

JOHN

JBUCK26STO

BUCKLER

JULIE

JPEER89RIA

PEERCE

JAN

HJOHN455OT

JOHNSON

HENRY

MASH912AE

ASH

MARY

DEDGE338BR

EDGECOMB

DAVID

AORLA55VEN

ORLANDO

AMY

 

 

 

11 ITEMS LISTED.

 

 

 

>

 

>CREATE-FILE CUSTNAMES 3 3

[417] FILE 'CUSTNAMES' CREATED; BASE = 9071, MODULO = 3.

 

[417] FILE 'CUSTNAMES' CREATED; BASE = 9075, MODULO = 3.

 

>REFORMAT CUSTOMERS LAST-NAME FIRST-NAME CUST-ID ID-SUPP

 

FILE NAME: CUSTNAMES

 

>COPY DICT CUSTOMERS 'FIRST-NAME' 'CUST-ID'

TO: (DICT CUSTNAMES)

   .

   .

   .

Next, the Attribute Definition items in the dictionary of CUSTNAMES are edited in order to change the attribute numbers. FIRST-NAME is made Attribute 1 and CUST-ID is made Attribute 2. Now it is possible to generate reports from the CUSTNAMES file:

>SORT CUSTNAMES FIRST-NAME CUST-ID

 

 

 

PAGE 1

14:33:53  dd mmm yyyy

CUSTNAMES...

First Name ...

Cust-ID

 

 

 

ASH

MARY

MASH912AE

BOHANNON

JOHN

JBOHA126TR

BUCKLER

JULIE

JBUCK26STO

EDGECOMB

DAVID

DEDGE338BR

JENKINS

HAROLD

HJENK1222M

JOHNSON

ALICE

AJOHN760JE

 

HENRY

HJOHN455OT

LEARY

BILL

BLEAR34TRE

ORLANDO

AMY

AORLA55VEN

PEERCE

JAN

JPEER89RIA

PIRS

SANDRA

SPIRS112A

 

 

 

10 ITEMS LISTED.

 

 

 

>

Notice that the two Johnsons are now stored as one MultiValued item under the single item-ID JOHNSON.