Where allowed to run: All environments (*ALL) Threadsafe: Conditional |
Parameters Examples Error messages |
The Copy Source File (CPYSRCF) command copies a database source file or DDM file to a source physical file or DDM file and converts the character data from the from-file CCSID to the to-file CCSID. If TOFILE(*PRINT) is specified, a formatted printer file is created by using the IBM-supplied printer file QSYSPRT (the file is changed for source records and is different from other copy command file formats). Any overrides issued for the from-file or to-file apply to the files used in the copy operation. Record data is copied from the from-file to the to-file, converting character data from the from-file CCSID to the to-file CCSID. Other differences in record formats (like that of the FMTOPT(*NOCHK) parameter option on the CPYF command) are disregarded.
Note: For more information on DDM files, see the Distributed Data Management information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
One member, all members, or a generic set of members can be copied each time the command is called. From-file members can be copied to like-named to-file members or to a single to-file member. Many members are copied and listed in alphabetical order. The to-file must exist when the CPYSRCF command is started. This command does not create the to-file, but it does add a member to an existing physical file if the member does not already exist in the to-file.
This command offers a subset of the parameters available on the CPYF command. Note that the default for the MBROPT parameter is *REPLACE (unlike other copy commands), which clears existing records in the receiving member of the to-file before replacing them with records copied from the from-file. Also, the default for the TOMBR parameter is *FROMMBR, which causes from-file members to be copied to like-named to-file members.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMFILE | Data base source file | Qualified object name | Required, Positional 1 |
Qualifier 1: Data base source file | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
TOFILE | To file | Single values: *PRINT Other values: Qualified object name |
Required, Positional 2 |
Qualifier 1: To file | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
FROMMBR | From member | Generic name, name, *FIRST, *ALL | Required, Positional 3 |
TOMBR | To member or label | Name, *FROMMBR, *FIRST | Optional, Positional 4 |
MBROPT | Replace or add records | *REPLACE, *ADD | Optional, Positional 5 |
SRCOPT | Source update options | Single values: *SAME Other values (up to 2 repetitions): *SEQNBR, *DATE |
Optional |
SRCSEQ | Source sequence numbering | Element list | Optional |
Element 1: Starting sequence number | 0.01-9999.99, 1.00 | ||
Element 2: Increment number | 0.01-9999.99, 1.00 |
Top |
Specifies the name and library of the database source file that contains the records copied.
The possible library values are:
The possible values are:
Top |
Specifies the file that receives the copied records.
The possible values are:
The possible library values are:
Top |
Specifies the file member(s) copied from the from-file. A single member, a generic set of members, or all members in the from-file are copied. Members are copied and listed in alphabetical order.
The possible values are:
Top |
Specifies the name of the file member that receives the copied records.
If *PRINT is specified for the To file prompt (TOFILE parameter), either *FIRST or *FROMMBR must be specified on this parameter.
The possible values are:
If a member name or *FIRST was specified as a value for the FROMMBR parameter, then a member in the to-file with the same name receives the records copied. If *ALL or a generic member name is specified as a value for the FROMMBR parameter, each member in the from-file is copied into a member with the same name in the to-file. Records from one or more members (specified by the FROMMBR parameter) in the from-file are copied to the first member in the to-file.
Top |
Specifies whether the new records replace or are added to the existing records.
The possible values are:
Top |
Specifies whether new values are assigned to the source sequence number and date fields when records from the from-file are copied to the to-file. New values can be specified in either or both fields.
Top |
Specifies, only when *SEQNBR is also specified in the Source update options prompt (SRCOPT parameter), the starting and end values added for creating the first and subsequent of sequence number record copied to the to-file. The value added is used to renumber all other records that are copied. The maximum value for sequence number is 9999.99; if a value is larger than this limit, additional records in the member are assigned the sequence number 9999.99.
The possible values for sequence number are:
The possible values for increment-number are:
Top |
Example 1: Replacing Existing Records
CPYSRCF FROMFILE(QGPL/QCLSRC) TOFILE(MYLIB/CLSRC) FROMMBR(PGMA)
This command copies records from member PGMA of database source file QCLSRC which is in the QGPL library. The defaults for the TOMBR and MBROPT parameters are taken so the records are copied to a like-named member (PGMA) of CLSRC in library MYLIB and replaces existing records in the member. If member PGMA does not exist in the to-file, it is added as part of the copy operation. If the CCSID of QGPL/QCLSRC is different from the CCSID of MYLIB/CLSRC, the character data is converted to the CCSID of CLSRC.
Example 2: Printing Files
CPYSRCF FROMFILE(QRPG/QRPGSRC) TOFILE(*PRINT) FROMMBR(INV*)
This command copies from database source file QRPGSRC in library QRPG, all file members whose names start with the characters INV. Special value *PRINT is specified for the to-file, so the records are copied to the printer and listed in a format tailored to source records, much like the printout created by SEU. Character data is not converted when specifying TOFILE(*PRINT).
Example 3: Changing the Increment Value
CPYSRCF FROMFILE(MYLIB/TXTSRC) TOFILE(QIDU/QTXTSRC) FROMMBR(*ALL) SRCOPT(*SEQNBR *DATE) SRCSEQ(1 .25)
This command copies all the members of database source file TXTSRC in library MYLIB. They are copied and replace (by using the default MBROPT(*REPLACE)) the existing records in like-named members (by using default TOMBR(*FROMMBR)) of data source file QTXTSRC in library QIDU. If the to-file members do not exist, they are added by the copy operation. For each member copied, the first record is numbered 1 and each following number is incremented by 0.25. Also, the source date field is set to zero in each record. If the CCSID of MYLIB/TXTSRC is different from the CCSID of QIDU/QTXTSRC, the character data is converted to the CCSID of QIDU/QTXTSRC.
Top |
*ESCAPE Messages
Top |