

Accessing Auxiliary Storage: FILE › VSAM Files › FILE Functions for VSAM Records › Copy a VSAM Record from One File to Another
Copy a VSAM Record from One File to Another
To copy a record from one file to a second file, specify the READ function for the first file and the ADD function for the second file.
- To retrieve the record you want to copy, specify the following, and then press Enter or browse the file:
FILEID= file ID of source file
FUNC= GET
RCID= key
- After FILE displays the record, specify the following, and then press Enter:
FILEID= file ID of destination file
FUNC= ADDU
- Make any necessary changes, then specify the following, and press Enter:
FUNC= PUT
RCID= key
SIZE= record length
Note: Specify the SIZE field only when adding a variable length record.
FILE redisplays the record and displays the message RECORD ADDED.
Repeat Steps 1 through 3 to copy additional records.
Note: If the LRECLs of the two files differ, the LRECL of the destination file determines the size of the record. The record will either be truncated or padded with binary zeros to meet that length.
Example
To copy a record with the key 'REC050' from the ACCTS file to the TEST file, follow these steps:
- Specify the following, and then press Enter to display the record:
FILEID= ACCTS
FUNC= GET RCID= C'REC050
- Specify the following, and then press Enter:
FILEID= TEST
FUNC= ADDU
- Specify the following, and then press Enter:
FUNC= PUT
RCID= C'REC001'
Delete VSAM Records
To delete a record, follow these steps:
- Specify the DELETE operation on the FILE definition.
- Specify the following required information:
FUNC= DEL
To delete a single record, follow these steps:
- Specify the following:
RCID= full record key
- Press Enter.
To delete all records having a generic (partial) key (KSDS files only), follow these steps:
- Specify the following:
RCID= generic key
SRCHTYP= GKEQ
ARGTYP= KEY
- Press Enter.
Notes:
- FILE deletes all the records whose keys match the generic key unless BACKUPTYPE DYNAMIC is specified for the FILE definition because CICS does not permit generic key deletion for FILE defined with this option
- If a single record is deleted, FILE displays it with the message RECORD DELETED.
- If you specify SRCHTYP=GKEQ, FILE displays the first record deleted. The message field specifies the number of deleted records xxx RECORDS DELETED.
Examples
- To delete the record NEWREC001 from the ACCTS file, specify the following, and then press Enter:
FILEID= ACCTS
FUNC= DEL
RCID= C`NEWREC001'
- To delete all records whose keys start with the character string NEWREC from the ACCTS file, specify the following, and then press Enter:
FILEID= ACCTS
FUNC= DEL
SRCHTYP= GKEQ
RCID= C`NEWREC'
ARGTYP= KEY
Copyright © 2014 CA Technologies.
All rights reserved.
 
|
|