Adding, replacing, and updating records (MBROPT parameter)
Many i5/OS® copy commands enable you to add or replace existing data in the to-file specifying different attributes on the MBROPT parameter.
These commands include CPYF, CPYFRMQRYF, CPYFRMTAP, andCPYSRCF. The CPYF command also allows you to update duplicate key records and add nonduplicate key records to a to-file member.
You can do these tasks by specifying *REPLACE, specifying *ADD, or specifying *UPDADD on the MBROPT parameter.
- Specifying *REPLACE when copying files
By specifying *REPLACE, you essentially clear the member. The copied records are the only records in the member when the operation completes. You must have authority to clear the member in order to specify MBROPT(*REPLACE).
- Specifying *ADD when copying files
When you specify *ADD, each record copied is added to the end of the existing records in the member.
- Specifying *UPDADD when copying files
When you specify *UPDADD on the CPYF command, a from-file key value builds before the from-file record moves into the to-file. The from-file builds this key value by using the key specifications of the to-file.
- Copying records into files that use trigger programs
Triggers enable you to perform copy actions automatically when a specified change operation occurs.
Parent topic:
Copying files
Related concepts
Copying physical or logical files
Copying records into files that use trigger programs