CSV-COPY

Generates a formatted list of attributes and copies them to a Reality CSV file created with the MAKE-SPECIAL command.

Syntax

CSV-COPY file-specifier {item-list} {selection-criteria} {USING file-specifier} {output-specification} {format-specification} {macro-call}

Refer to The English Sentence for details of parameters.

Prompt

The following prompt is displayed:

DESTINATION FILE:

You must enter a file specifier specifying the Reality CSV file where the new items should be written. If the file you specify is not a CSV file, an error message is displayed.

Restrictions

Normally SYSMAN account only, but can be used in another account if copied into its MDClosed Master Dictionary - the dictionary file that defines an account. It contains items that point to the code executed by all the TCL commands, to SYSTEM accounts, and to other accounts by means of Q-pointers. The MD also includes all File Definition Items for the account and other items. . To have the command added automatically to new accounts, add it to the USER data section of the NEWAC file.

The use of the BREAK-ON and TOTAL connectives in the output-specification is discouraged, because they will break the one-to-one mapping between the selected items and the CSV items.

Operation

When you use CSV-COPY, each selected item becomes an item in the CSV file, with attributes as specified in output-specification. These items are given numeric item-ids, starting at one and increasing by one for each subsequent item.

Caution

Existing items with the same item-ids are overwritten.

A heading item is also created with item-id 0, containing one attribute for each attribute in the output specification. Each attribute of this heading item contains the text from attribute 3 of the corresponding data definition item, if any, from the source file; where there is no data definition item, the attribute is left blank. In addition, a data definition item is created in the dictionary of the CSV file for each field, in the same way as for MAKE-SPECIAL.

If you omit the explicit output specification, you must specify a macro that generates an implicit output specification. The default macro is not run automatically.

Example

:LIST UNION '355' '222' '483' LAST-NAME CITY COUNTRY

Page    1                                            11:03:24  06 Apr 2005
UNION..... Surname.... City.......... Country...
355        Wilkinson   Newcastle      UK
222        O'Driscoll  Dublin         Eire
483        Michalak    Paris          France
3 Items listed.
:CSV-COPY UNION '355' '222' '483' LAST-NAME CITY COUNTRY
DESTINATION FILE:CSVDATA

3 items copied.
:

The CSV-COPY command creates the following items in the file CSVDATA:

Header item
    0
001 LAST NAME
002 CITY
003 COUNTRY
Data items
    1                   2                   3
001 Wilkinson 001 O'Driscoll 001 Michalak
002 Newcastle 002 Dublin 002 Paris
003 UK 003 Eire 003 France
Data definition items
    SURNAME             CITY                COUNTRY
001 A 001 A 001 A
002 1 002 2 002 3
003 Surname 003 City 003 Country
004 004 004
005 005 005
006 006 006
007 007 007
008 008 008
009 L 009 L 009 L
010 10 010 10 010 10
Host CSV file
"Surname","City","Country"
"O'Driscoll","Dublin","Eire"
"Michalak","Paris","France"
"Wilkinson","Newcastle","UK"