COZZI-Copy Source Members (CPYSRCMBR)

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

Parameters

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

From member (FROMMBR)

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.

*ALL
All source members in the file are checked against the WHEN parameter, and if a match is detected, the member is copied.
generic-name
Specify the generic name of the group of members to be copied. Each member is compared to the WHEN parameter and if a match is detected, the member is copied.
name
Specify the name of an individual member to be copied. The member is compared to the WHEN parameter and if a match is detected, the member is copied.
Top
Top
Top
Top

When to copy the From Mbr (WHEN)

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

*NEWMBR, *NEW, or *NOEXISTS
The FROMMBR is copied to the TOSRC when the FROMMBR does not exist in the TOSRC file.
*OLDMBR, *OLD, or *EXISTS
The FROMMBR is copied to the TOSRC when the FROMMBR exists in the TOSRC file.
*NEWER
The FROMMBR is copied to the TOSRC when the FROMMBR does not exist in the TOSRC file OR when the FROMSRC has a later last-change-date; that is, when the FROMMBR is "newer" than the TOMBR.
*ALL
The FROMMBR is copied to the TOSRC without checking if the members exists in the TOSRC file.

Element 2: Source Last Change Date

Source Member Last Change Date Test

*ALL
The FROMMBR source member Last Change date is not checked for the copy to be performed.
*CHGDATE or *NEW
The FROMMBR source member Last Change date must be newer (later) than the last change date of the member in the TOSRC file. NOTE: If the EXISTS test is *NEW then when the FROMMBR does not exist in the TOSRC file, the member is copied regardless of its Last Change date.
*OLD
The FROMMBR source member Last Change date must be older (earlier) than the last change date of the member in the TOSRC file. NOTE: If the EXISTS test is *NEW then when the FROMMBR does not exist in the TOSRC file, the member is copied regardless of its Last Change date.

Element 3: Creation date

Source Member Creation Date Test

*ALL
The source member creation date is not checked.
*CRTDATE or *NEW
The FROMMBR source member creation date must be newer (later) than the creation date of the member in the TOSRC file. NOTE: If the EXISTS test is *NEW then when the FROMMBR does not exist in the TOSRC file, the member is copied regardless of its creation date.
*OLD
The FROMMBR source member creation date must be older (earlier) than the creation date of the member in the TOSRC file. NOTE: If the EXISTS test is *NEW then when the FROMMBR does not exist in the TOSRC file, the member is copied regardless of its creation date.
Top

Write CPYSRCF commands to joblog (LOG)

Specifies that each CL command generated to perform the source member copy operation is recorded in the JOBLOG as a *RQS message.

*YES
The composed CPYSRCF (Copy Source File Member) commands are written to the joblog as *RQS messages. This allows the response messages (if any) generated by the command to be recorded in the joblog below and in the context of the corresponding CPYSRCF command. The commands may also be duplicated interactively, using F9.
*NO
The composed CPYSRCF commands are not recorded into the joblog.
*ALL
Everything from LOG(*YES) is recorded to the joblog plus an additional message is written whenever a Source Member is omitted from the copy operation. This is often not needed and is therefore only written when LOG(*ALL) is specified.
Top

Maximum *RQS message to log

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.

*NOMAX
All *RQS messages are written to the joblog. If the joblog message queue becomes full, the joblog will wrap or the job will fail depending on the setting of the "Job message queue full action" (JOBMSGQFL) attribute for the job. Consider setting this attribute to JOBMSGQFL(*WRAP) or JOBMSGQFL(*PRTWRAP) using the CHGJOB command in order to avoid having the system end your job upong a full job message queue.
1-999999
Specify the number of *RQS messages (the number of CPYSRCF commands) that are written to the joblog before no more are written. Basically this is a way to prevent the joblog from filling up and the job failing when JOBMSGQFL(*NOWRAP) is specified for the job and large number of source members are expected to be copied to the TOSRC file. Limiting the number of *RQS messages does not impact *DIAG, *COMP, and *INFO messages generated in response to each CPYSRCFM command that is issued by the CPYSRCMBR command.
Top

Examples for CPYSRCMBR

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

Error messages for CPYSRCMBR

*ESCAPE Messages

CPF9801
Object &2 in library &3 not found.
CPF9802
Not authorized to object &2 in &3.
CPF9803
Cannot allocate object &2 in library &3.
CPF9807
One or more libraries in library list deleted.
CPF9808
Cannot allocate one or more libraries on library list.
CPF9810
Library &1 not found.
CPF9811
Program &1 in library &2 not found.
CPF9812
File &1 in library &2 not found.
CPF9820
Not authorized to use library &1.
CPF9830
Cannot assign library &1.
CPF9899
Error occurred during processing of command.
Top