TAA Tools
CPYSRCF2        COPY SOURCE FILE 2                     TAASRDL

The  Copy Source  File  2  command is  similar  to the  system  CPYSRCF
command.   The  major difference  is that  the  TOFILE member  is first
copied  to an Old Version  File.  This allows  a backup of the replaced
version or a swap (see later discussion).

A typical command would be entered as:

         CPYSRCF2     FROMFILE(xxx) TOFILE(yyy) OLDVERFILE(zzz)
                        FROMMBR(ABC)

The  command  would  access  the  member  in  the  FROMFILE.    If  the
corresponding member  existed in the  TOFILE, it would first  be copied
to  the OLDVERFILE.  The FROM  file member would then  be copied to the
TOFILE.

A generic member  name or all members  may be specified.   There is  no
member parameter  for the To file  or Old Version file.   Corresponding
member names are assumed based on the FROMMBR parameter.

If  a generic  name is specified,  a list  of members is  accessed from
the FROM file.   Only those  members are copied  and any  corresponding
members in  the TO  file.   This prevents  copying a member  in the  TO
file of  the same generic name  which does not exist in  the FROM file.

If  no corresponding member exists  in the TO file,  no action is taken
on the Old Version file.

Source type changes
-------------------

If  the To  file  member  has a  different  source  type than  the  Old
Version  file  member, the  Old  Version  file  member source  type  is
changed.

If  the From file member has  a different source type  than the To file
member, the To file member source type is changed.

Text description changes
------------------------

If the To  file member has  a different text  description than the  Old
Version file  member, the Old Version  file member text  description is
changed.

If the  From file member has  a different text description  than the To
file member, the To file member text description is changed.

Members with no records
-----------------------

Special handling occurs  if one  of the  members to  be copied  exists,
but has no records.

  **   If a single  member is specified  on the command and  no records
       exist in  the FROM member,  the command sends  an escape message
       (same  as CPYSRCF).   If no records  exist in the  TO member, an
       empty member is ensured in the Old Version file.

  **   When *ALL  or  a generic  request is  specified  and no  records
       exist in  a FROM member,  an empty member  is ensured in  the TO
       file.   If no records exist  in a TO member,  an empty member is
       ensured in the Old Version file.

Swapping source members
-----------------------

CPYSRCF2 will  not  cause  a swap  (each  file used  must  be  unique).
However, you can combine CPYSRCF2 and CPYSRCF to cause a swap.

For example, assume you  have a small file of  members (SMALL) that you
want  to temporarily  swap with  the corresponding  members in  a large
source  file  (LARGE).    You  could  achieve  a  swap  by  doing   the
following:

  **   Create a separate source file (e.g.  BACKUPSRC)

  **   Use CPYSRCF2 to swap in the members from the SMALL file.

          CPYSRCF2    FROMFILE(SMALL) TOFILE(LARGE)
                        OLDVERFILE(BACKUPSRC) FROMMBR(*ALL)

  **   Perform your function using the swapped in members.

  **   Use CPYSRCF to swap back the original versions.

          CPYSRCF     FROMFILE(BACKUPSRC) TOFILE(LARGE)
                        FROMMBR(*ALL)

As long  as all  members have  some records (no  empty members  exist),
this technique will work effectively.

Command parameters                                    *CMD
------------------

   FROMFILE      The  qualified file  name of  the 'From'  source file.
                 The  library value defaults to  *LIBL.  *CURLIB may be
                 specified.

   TOFILE        The  qualified file  name  of  the 'To'  source  file.
                 The library  value defaults to *LIBL.   *CURLIB may be
                 specified.

   OLDVERFILE    The  qualified file name  of the  'Old Version' source
                 file.  The library value  defaults to *LIBL.   *CURLIB
                 may be specified.

   FROMMBR       The member to  be copied.  A generic name  or *ALL may
                 be specified.

Restrictions
------------

None.

Prerequisites
-------------

The following TAA Tools must be on your system:

     ALCTMPMBR    Allocate temporary member
     CHKGENERC    Check generic
     EDTVAR       Edit variable
     SNDCOMPMSG   Send completion message
     SNDESCMSG    Send escape message
     SNDSTSMSG    Send status message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   CPYSRCF2      *CMD                   TAASRDL       QATTCMD
   TAASRDLC      *PGM       CLP         TAASRDLC      QATTCL
					

Added to TAA Productivity tools May 1, 1996


Home Page Up to Top