TAA Tools
SAVICHDTA      SAVE INTERCHANGE DATA           TAASAVD

The Save  Interchange Data  command allows  you to  interchange one  or
more members  in data interchange  mode rather than  Save/Restore mode.
This  can  be of  particular  advantage when  interchanging  source and
small data files between:

  **   Two different i5 Systems  which are at different release  levels
       and the save to previous release support cannot be used.

  **   An i5  System and an  S/38.  An  option exists to add  or remove
       the  '38'  entry  and  convert  certain  entries  (e.g.    CLP38
       becomes CL).

See the later  discussion about how  to use the  RSTICHDTA function  on
an S/38.

The SAVICHDTA command  writes one or more members into  a physical file
separated  by a  uniquely identified  record.   You would  normally use
one of the copy  commands to copy  the file to  diskette, tape or  send
this file  to another  system using  DDM or  some other  communications
approach.

Assuming  the other system  is running  i5/OS, you would  normally copy
the  file into a data  base file and then use  the RSTICHDTA command to
extract the data and make normal members.

Source files up to a length  of 125 are supported.  Data files up  to a
length of 4500 bytes are supported.  No logical files are allowed.

The  record length  size  for data  interchange  is 125  bytes of  data
followed  by  a blank  and then  a  2 byte  control  field or  128 byte
records.   If  the  actual  record size  exceeds  125  bytes,  multiple
records will appear  in the interchange file for each  actual data base
record.    Record sizes  less  than  125 are  handled  properly.   Most
source files will fit within  125 bytes.  The  only or last segment  of
a record is padded to fill out the 125 bytes.

Because of this technique,  SAVICHDTA is not as efficient as  a save or
restore.   It's  advantage is that  it does  not have  any Save/Restore
restrictions  regarding which release can be  used because it uses data
interchange format.    You should  restrict the  use  to small  members
(e.g.  source) or control files.

The  files must  exist  on the  system  to use  the RSTICHDTA  command.
That  is, if  you used  SAVICHDTA to  save FILEA  on one  system, FILEA
must exist on the  system that you do RSTICHDTA  on.  The members  will
be added  if they  do not  exist.  If  a member  name exists,  the data
will be replaced.

The  commands use  the ICHDTAP  data base file  which must  be created.
The create command should specify:

       CRTPF    FILE(ICHDTAP)
                  RCDLEN(128)
                  SIZE(50000 10000 5)
                  TEXT('File used by SAV/RSTICHDTA')

Assume you  want to  move 3  source members  from the  standard  source
file names (e.g.   QCMDSRC, QCLSRC etc.) in library  PRODUCTION and the
data  base  file PAYCTLP  to  another  system using  tape.   You  would
specify:

      SAVICHDTA    LIB(PRODUCTION) LIST((*CMD PAYROLL)(*CLP PAYROLLC) +
                    (*RPG PAYROLL)(PAYCTLP *ALL))
      CPYTOTAP     FROMFILE(ICHDTAP) TOFILE(QTAPE) TODEV(TAP01)

On  the  target  system, you  want  to  copy the  tape  media  into the
ICHDTAP file and then  restore the source members back to  the standard
source file  names and the PAYCTLP  file into library PRODUCTION.   You
would specify:

      CPYFRMTAP    FROMFILE(QTAPE) FROMDEV(TAP01) TOFILE(ICHDTAP) +
                     FROMLABEL(ICHDTAP) MBROPT(*REPLACE)
      RSTICHDTA    LIB(PRODUCTION)

The  *ALL  option on  the  SAVICHDTA command  copies all  members  of a
file.  It is the  default entry.  It is  normally used for data  files,
but can also be used for source files such as:

      SAVICHDTA    LIB(PRODUCTION) LIST((*CMD *ALL))

The member parameter also supports a generic name so you may specify:

      SAVICHDTA    LIB(PRODUCTION) LIST((*CMD PAY*)(*CLP PAY*) +
                    (*RPG PAY*)(*PF PAYMST))

Differences from CPYF
---------------------

The SAVICHDTA command differs from CPYF by the following major items:

  **   CPYF works  with a single  file at a time.   If a  unique member
       name is specified, CPYF works only with a single member.

  **   CPYF  does  not  handle record  sizes  beyond  the TOFILE  size.
       Only truncation is supported.

  **   CPYF does not  make a separator  record for a  new member.   You
       can add  records to  a file with  CPYF, but  there is  no unique
       record output to act as a separator.

Separator record
----------------

The SAVICHDTA  command extracts the  source records and  writes them to
the  ICHDTAP file  with a  standard separator.   The separator  has the
following format:

      1 - 10    File
     11 - 20    Library
     21 - 30    Member
     31 - 40    Source type
     41 - 50    Number of records
     52 - 57    Member change date
     59 - 64    Member change time
     66 - 70    Record length
     72 - 121   Member text
    127 - 128   **

Unused positions are blank.

The FILE and MEMBER  values are used to  access the file/member in  the
library named  on the RSTICHDTA  command.  The  same file name  used on
the  SAVICHDTA must  also exist  for the restore,  but the  library may
differ.

If the  member does  not  exist, it  is  added.   The source  type  and
member text  extracted by  the SAVICHDTA  command are  used when a  new
member  is added.   If the  member exists,  the data is  replaced (i.e.
cleared first).

An option exists  on the  commands to add  or remove  the special  '38'
values and convert certain types (e.g.  CLP38 is changed to CL).

Note that  the library  name in  the separator record  exists only  for
documentation  and is not  used during the  restore.  The  library name
on  the RSTICHDTA command is  used.  The other  fields in the separator
record are used only for documentation.

The record length  of the file  saved with SAVICHDTA  must be the  same
as the file to be written to or the RSTICHDTA command will fail.

The codes placed in position 127-128 of each record are as follows:

            **   Separator record as described previously
            *0   A complete data record (i.e. it fits completely in
                   125 bytes available with or without padding)
            01   The first record of a group of records that require
                   more than one 125 byte segment
         02-29   The Nth records in a group
            *E   The last record in a group

If a record length  of 400 bytes is used, there would be  an 01, 02, 03
and  and *E record  for each record  in the  file.  There  would be 375
bytes of  data  in  the first  three  records.   The  *E  record  would
contain the  remaining bytes for  the record which  in this  case would
be the last 25 bytes plus 100 blanks.

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

Only  physical  files can  be  saved.   The  files  saved  on a  single
command must  all be  in the  same  library, but  may be  of  differing
lengths.  If the file has no members, it cannot be saved.

The maximum  record size  which can be  saved for  source files  is 125
and for data files is 4500 bytes in length.

Considerations
--------------

It is  valid to save  a file that  has no records  in the member.   The
separator  record  will be  immediately  followed by  another separator
record.

SAVICHDTA command parameters                          *CMD
----------------------------

   LIB           The library  which contains the  files.   For a  given
                 command, all  files must  come from the  same library.
                 On  the RSTICHDTA command, all  files must be restored
                 to a single library, but  it may differ from the  save
                 library.

   LIST          The  list of  file/members to  be  saved.   This is  a
                 list  of up to 50  entries.  Each entry  is made up of
                 two elements:

        FILE          The file containing  the member.   The file  must
                      be in  the library  named on  the LIB  parameter.
                      The  special  entries  of  *CL, *CLP,  *RPG  etc.
                      can  be  used  to designate  the  standard source
                      file names.

        MBR           The member  name to  be  saved.   The default  is
                      *ALL  meaning to  save all  members in  the file.
                      A  generic  value  may also  be  entered  such as
                      PAY* to  save  all  the  members  beginning  with
                      PAY.   *FIRST  is also  valid to  save the  first
                      member.

   ICHDTAPLIB    The   library  containing  the  ICHDTAP   file.    The
                 default is *LIBL.   Note  that the  default may  cause
                 the file to be  in a different library than  the files
                 being saved.

   TOMBR         The member  name of the ICHDTAP file.   The default is
                 *FIRST.

   MBROPT        Controls  if  the  TOMBR  (in  the  ICHDTAP  file)  is
                 cleared before  writing records  to it.   The  default
                 is  *REPLACE meaning to  clear the  member.   *ADD may
                 be  specified to  add  to the  records already  in the
                 file.

   RMV38         A *YES/*NO option which defaults  to *NO.  *YES  means
                 to strip  off the 38 in  the source type (e.g.   CLP38
                 becomes CLP).   This allows an i5  System to send S/38
                 type source  to a  S/38 and  have the  correct  source
                 type restored.

Note that if you specify  a generic or *ALL value for the  member and a
special type like *PF such as:

      SAVICHDTA    LIB(PRODUCTION) LIST((*PF *ALL))

The *PF  entry is a shorthand for  QDDSSRC.  You would save  all of the
source members in QDDSSRC and not just the *PF types.

For  the SAVICHDTA command, if  1) a file/member cannot  be found or 2)
no members exist  for a generic  group, a diagnostic  is sent for  each
error  and the  command  will complete  with  an escape  message.   Any
members which are valid will be saved.

If 1)  the file does not exist or 2)  the file has no members or 3) the
file  is  not  a  physical   file,  the  command  will  fail  with   an
appropriate escape  message.   This may occur  after some  members have
been saved.

If the  command completes normally, a  completion message describes the
number of members successfully copied.

RSTICHDTA command parameters                          *CMD
----------------------------

   LIB           The library  which contains  the files  to be  written
                 to.   This may  differ from  the library  used on  the
                 SAVICHDTA command.   All files must be  written to the
                 same library.

   ICHDTAPLIB    The   library  containing  the   ICHDTAP  file.    The
                 default is *LIBL.

   FROMMBR       The member name of  the ICHDTAP file.  The  default is
                 *FIRST.

   ADD38         A *YES/*NO  option which defaults to *NO.   *YES means
                 to  add '38'  to the  source type  (e.g.   CLP becomes
                 CLP38).  This  allows S/38s  to send source  to an  i5
                 System and have the correct source type.

The RSTICHDTA command  ensures that the group records (i.e.   caused by
records exceeding 125 bytes in length) are in sequence.

Any  errors  on  the  RSTICHDTA  command  cause  the  command  to  fail
immediately.  This may result in  some of the members being copied  and
some not.

If errors  occur (e.g.   no file exists),  you can correct  the problem
and  reissue the  command.    There is  no  method of  starting  in the
middle  of the  ICHDTAP file,  but this could  be done  using an OVRDBF
command and  the POSITION  parameter  to describe  the relative  record
number start position.

If  the  command  completes   normally,  a  completion  message  exists
describing the number of members copied.

Restoring to an S/38
--------------------

To  assist  you in  using  the S/38  version,  a CLP38  type  source is
provided.  You should  do the following steps  to create the  RSTICHDTA
function on an S/38.

  1.   The  command  definition  source   for  RSTICHDTA  (TAASAVD2  in
       QATTCMD)  should be copied  in data  interchange mode (e.g.   to
       diskette or  tape)  and placed  on  the  S/38.   Use  CRTCMD  to
       create RSTICHDTA  using the  TAASAVD2 command definition  source
       and specify PGM(TAASAVDC3).

  2.   The  CPP for RSTICHDTA  (TAASAVDC3 in  QATTCL) should  be copied
       in  data interchange  mode and  placed on  the S/38.   There are
       two commands which  exist in the  source (ADDSRCMBR and  EDTVAR)
       that are  used in the  CL program.   These commands are  part of
       the  S/38 Tips and Techniques TIPSTECH library.   If this is not
       available to  you, there  are instructions  in  the program  for
       how  to bypass  the  functions provided.    See  the source  for
       TAASAVDC3.  Use CRTCLPGM to create TAASAVDC3.

  3.   The RPG  source (TAASAVDR2 in QATTRPG) should  be copied in data
       interchange mode  and placed  on  the S/38.   Use  CRTRPGPGM  to
       create TAASAVDR2.

Once the  objects are  created, you  can use the  RSTICHDTA command  on
S/38 to transfer source from an i5 System to the S/38.

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

The following TAA Tools must be on your system:

      CHKDBF        Check data base file
      CHKGENERC     Check generic
      EDTVAR        Edit variable
      RTVGENMBR     Retrieve generic member
      SNDCOMPMSG    Send completion message
      SNDDIAGMSG    Send diagnostic message
      SNDESCMSG     Send escape message
      SNDSTSMSG     Send status message

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

The tool  is ready to  use, but you must  create the data  base file to
save into such as:

       CRTPF    FILE(ICHDTAP)
                  RCDLEN(128)
                  SIZE(50000 10000 5)
                  TEXT('File used by SAV/RSTICHDTA')


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

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

   SAVICHDTA     *CMD                      TAASAVD        QATTCMD
   RSTICHDTA     *CMD                      TAASAVD2       QATTCMD
   TAASAVDC      *PGM          CLP         TAASAVDC       QATTCL
   TAASAVDC2     *PGM          CLP         TAASAVDC2      QATTCL
*      No object                           TAASAVDC3      QATTCL
   TAASAVDR      *PGM          RPG         TAASAVDR       QATTRPG
   TAASAVDR2     *PGM          RPG         TAASAVDR2      QATTRPG
** ICHDTAP       *FILE         PF              No source

* The TAASAVDC3  source  is  for  the  S/38  version.  See  the  prior
discussion.

** The ICHDTAP file must be created using the CRTPF command described
previously.

Structure
---------

   SAVICHDTA
     TAASAVDC  CL pgm
       TAASAVDR  RPG pgm
         ICHDTAP physical

   RSTICHDTA
     TAASAVDC2 CL pgm
       TAASAVDR2   RPG pgm
         ICHDTAP physical

See  the  previous discussion  for using  RSTICHDTA on  S/38 concerning
the TAASAVDC3 CLP38 program.
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top