COPYP

COPYP

Top  Previous  Next

 

The COPYP command copies selected records from one file to another, or within the same file, using Pick syntax.

 

 

Format

 

COPYP {DICT }src.file  {id.list}  {options}

 

where

 

src.fileis the file from which the records are to be copied. The optional DICT prefix indicates that the dictionary portion of the file is to be used.

 

id.listis a list of ids of the records to be copied. If specified as an asterisk, all records in the source file are copied. If omitted, an active select list is used.

 

optionsis a list of option codes. These must be prefixed by an open parenthesis. The available codes are:
ACopy data in text mode, translating between field marks and newlines when copying between a hashed file and a directory file in either direction. This option is also needed to override implied binary mode when copying between directory files where the newline representation of the source and target are different (e.g. Windows to Linux).
BCopy data in binary mode, suppressing translation between field marks and newlines when copying between a hashed file and a directory file in either direction. This mode is implied if both are directory files.
DDeletes the source records after copying.
ISuppresses display of record ids.
NSuppresses pagination when displaying records on the terminal.
OOverwrites existing records in the target file.
PSends the record data to a printer.
SSuppresses field numbers with P or T.
TSends the record data to the terminal.

 

If the P or T options are used, the records identified by id.list are sent to the printer or the screen.

 

If neither the P nor T options are used, the command prompts for a space separated list of destination record ids. If there are more ids in id.list than in the destination list, the source id is used as the destination id for the extra items.

 

The destination list can begin with a file name prefixed by an open parenthesis to direct output to a different file. The name can optionally be followed by a close parenthesis.

 

@SYSTEM.RETURN.CODE is returned as the number of records copied or a negative error code.

 

The ALIAS command can be used to make COPYP the default for COPY without removing the ability for other users or software packages to access the original COPY command.

 

The COPYP command can be used with data collections but if either of the source and target files is a data collections, both must be.

 

 

Examples

 

COPYP ACCOUNTS * (D

To: (SAVED.ACCOUNTS

17 record(s) copied and deleted.

 

This command copies all records from the ACCOUNTS file to the SAVED.ACCOUNTS file, deleting the originals.

 

 

COPYP BP PRT.INVOICE

To: PRT.INVOICE2

1 record copied.

 

This command copies record PRT.INVOICE in the BP file to a record named PRT.INVOICE2 in the same file.

 

 

See also:

COPY