Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The COZZI-Copy Source Members (CPYSRCMBR) command performs a CPYSRCF under the covers, and provides options to control when the copy is performed. For example, you can specify that only new source members are copied to the target source file, only changed source members, only source members that were created after those in the target source file, or only source members that already exist in the target file, regardless of creation or change date. The CPYSRCMBR command creates a list of the source member in the FROMSRC (from source) file, and then based on the copy option, copies the selected members using an individual CPYSRCF command. If the operating system level is V6R1M0 or later, then the SRCTYPE(*FROMMBR) and TEXT(*FROMMBR) parameters are added to the CPYSRCMBR command, automatically.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMFILE | From source file | Qualified object name | Required, Positional 1 |
Qualifier 1: From source file | Name | ||
Qualifier 2: From library | Name, *LIBL, *CURLIB | ||
TOFILE | To source file | Qualified object name | Required, Positional 2 |
Qualifier 1: To source file | Name, *FROMSRC | ||
Qualifier 2: To library | Name, *FROMLIB, *LIBL, *CURLIB | ||
FROMMBR | From member | Generic name, name, *ALL, *FIRST | Required, Positional 3 |
TOMBR | To member | Name, *FROMMBR | Optional, Positional 4 |
MBROPT | Replace or add records | *REPLACE, *ADD | Optional, Positional 5 |
CRTFILE | Create To Source file | *CREATE, *YES, *NO | Optional, Positional 6 |
WHEN | Copy FROM Member, when | Element list | Optional, Positional 7 |
Element 1: FROMMBR exists in TOSRC | *ALL, *NEW, *OLD, *NEWMBR, *OLDMBR, *NEWER, *EXISTS, *EXIST, *NOEXISTS, *NOEXIST | ||
Element 2: FROMMBR Source Last Change | *ALL, *NEW, *OLD, *CHGDATE | ||
Element 3: FROMMBR Creation Date | *ALL, *NEW, *OLD, *CRTDATE | ||
LOG | Write CPYSRCF cmd to joblog | *YES, *NO, *ALL | Optional, Positional 8 |
MAXMSG | Maximum LOG messages to write | 1-999999, *NOMAX | Optional, Positional 9 |
Top |
Top |
Top |
Specifies the file member(s) copied from the from-file. A generic set of members, or all members in the from-file can be copied. Members are copied in alphabetical order.
This is a required parameter.
Top |
Top |
Top |
Top |
Specifies the condition used to control whether or not the FROMMBR is copied. When all conditions match, the FROMMBR is copied to the TOSRC. The following flags may be specified to control the COPY operation. The flags generally apply to the FROMMBR attribute being newer or older than the TOSRC member.
WHEN( exists last-change-date creation-date ) | +--Whether FromMbr exists in TOSRC *NEW - FROMMBR must not exist in TOSRC *OLD - FROMMBR must exist in TOSRC *NEWER - FROMMBR must not exist in TOSRC or FROMMBR must have a later last-changed-date.
The FROMMBR (from member) attributes for the Conditions are compared with the attributes of the same member in the TOSRC (to Source file). If the Conditions match, the FROMMBR is copied to the same member in the TOSRC source file.
Element 1: New or existing in TOSRC
Member Exists Test
Element 2: Source Last Change Date
Source Member Last Change Date Test
Element 3: Creation date
Source Member Creation Date Test
Top |
Specifies that each CL command generated to perform the source member copy operation is recorded in the JOBLOG as a *RQS message.
Top |
Specifies the maximum number of *RQS message to write to the joblog when LOG(*YES) is sepcified. This parameter is ignored when LOG(*NO) is specified.
Top |
Example 1: Copy New Source File Members Only
CPYSRCMBR FROMSRC(DEVSRC/QRPGLESRC) TOSRC(PRODSRC/*FROMSRC) FROMMBR(*ALL) WHEN(*NEW)
This command copies all the source members that do not currently exist in QRPGLESRC in PRODSRC from QRPGLESRC in DEVSRC to QRPGLESRC in PRODSRC.
Example 2: Copy Most Recent Changed Members
CPYSRCMBR FROMSRC(DEVSRC/QRPGLESRC) TOSRC(PRODSRC/*FROMSRC) FROMMBR(ORD*) WHEN(*ALL *CHGDATE)
This command copies all the source members that begin with "ORD" in QRPGLESRC in DEVSRC to QRPGLESRC in PRODSRC when the FROMMBR has a Source Last Change Date that is newer (more recent) than that of the target (TOSRC) member.
Example 3: Copy Existing Source Mbr w/Later SRCCHGDATE
CPYSRCMBR FROMSRC(DEVSRC/QRPGLESRC) TOSRC(PRODSRC/*FROMSRC) FROMMBR(PAY*) WHEN(*OLD *CHGDATE) MAXMSG(100)
This command copies all the source members that begin with "PAY" in QRPGLESRC in DEVSRC to QRPGLESRC in PRODSRC when the FROMMBR exists in the TOSRC file and the FROMMBR last change date is newer than that of the target (TOSRC) member. If more than 100 CPYSRCF commands are produced, on the first 100 are written to the joblog as *RQS messages.
Top |
*ESCAPE Messages
Top |