SAVSYSBCH       Save System in Batch                   TAASAWN

 The Save  System  in Batch  command is  designed  to allow  you to  run
 backup  functions in  batch that  require the  restricted state.   This
 includes  Save the Entire System (Option  21), Save System Data (Option
 22), and Save User Data  (Option 23).  This allows scheduling  of these
 functions  using  the  Job  Scheduler  or  the  SBMJOB  SCDDATE/SCDTIME
 function.  Both tape and virtual tape are supported.

 The  job   must  be  submitted  to  a  job  queue  in  the  controlling
 subsystem.

 You must have *SAVSYS special authority to use SAVSYSBCH.

 If the media  on the specified  devices cannot hold  the save  content,
 the command  will fail  as the  restricted state  prevents a user  from
 responding to any messages.

 A  job  log  is  always  output  and  the  TAA commands  CHKSAVRST  and
 PRTSAVLBL are optional to provide additional output.

 Getting started
 ---------------

 If you are going  to use virtual  tape, see the  CRTVTP TAA Tool  which
 can simplify operations.

 The S/R system  defaults used by the  system save functions need  to be
 entered or reviewed.  Enter:

            GO SAVE

 and request Option 20.

 The interactive  display will describe  the defaults that  will be used
 for the SAVETYPE options.

 Set at least the following:

            Devices                   Describe at least one device
            Prompt for commands       N
            Message queue delivery    *NOTIFY

 A  list of devices could be  entered if you have  more than one and the
 save data will not fit on a single media.

 If virtual  tape  is used,  a single  device should  be  named and  the
 DUPTAP function  to write to tape is  simpler if the maximum  size of a
 single virtual volume is large enough to hold the entire save.

 Other options should be set based on your requirements.

 You  should ensure that  the media you  are using does  not contain any
 files you  need.  Using  *OPT21 or  *OPT22 will  cause a  clear of  the
 media and the save begins at sequence 1.

 If you  want to clear  the media first,  a good  command to use  is the
 TAA  CLRTAP command  which extracts  the  current information  from the
 media label and uses INZTAP:

              CLRTAP    DEV(xxx)

 If the CRTVTP tool  is being used,  RPLVTP is a good  tool to use  both
 before the save to  ensure the proper readiness state  and after DUPTAP
 is used to free up the storage.

 Assume you  want to test  the function without  entering the restricted
 state  or  performing  a full  save.    The SAVETYPE  option  *TEST1 is
 intended to assist you in understanding the function:

              SBMJOB    JOB(SAVE) CMD(SAVSYSBCH SAVETYPE(*TEST1))

 The  *TEST1  function does  not  require  the  restricted  state.    It
 performs  basic checking  and saves  the TAACTL  *DTAARA in  TAATOOL to
 your media.  The command may also be entered interactively.

 Now  assume that you  want to try  the restricted state at  an off peak
 time.  You may want to have  a program such as described for the  EXIT1
 parameter to  send messages to any  active users informing them  that a
 shutdown  is  about to  occur.    Assume you  created  this  program as
 SNDBRKACT.

 Your SAVSYSBCH command could  be entered with a  SBMJOB command to  run
 at a  specific time using  the SBMJOB  SCDDATE and SCDTIME  parameters.
 The  job  must  be   submitted  to  a  job  queue  in  the  controlling
 subsystem.

              SBMJOB     JOB(SAVSYSBCH) CMD(SAVSYSBCH +
                           SAVETYPE(*TEST2) EXIT1(xxx/SNDBRKACT)) +
                           SCDDATE(nnnnnn) SCDTIME(nnnnnn)

 The  *TEST2 function also  saves the TAACTL *DTAARA  in TAATOOL, but in
 this case,  messages would  be sent  by SNDBRKACT  (if any  interactive
 jobs exist),  the restricted state  entered, the save would  occur, and
 the controlling subsystem would be re-started.

 Assume  you  are satisfied  with  how  SAVSYSBCH operates  and  are now
 ready to  enter  a  job  schedule  entry for  an  *OPT21  save  (entire
 system) each  Sunday morning  at 2:00  AM.   Assume you  know the  save
 will  fit on  a single media  (or you  have specified  multiple devices
 for the S/R defaults)  and you know  the time it takes  is less than  4
 hours  (240  minutes)  so  that  you  can  take  the  default  for  the
 RSDTIMLMT parameter.

 Using  ADDJOBSCDE  entry (or  the  prompt from  WRKJOBSCDE),  you would
 would enter:

              ADDJOBSCDE  JOB(SAVSYSBCH) +
                            CMD(SAVSYSBCH SAVETYPE(*OPT21) +
                            EXIT1(xxx/SNDBRKACT)) +
                            FRQ(*WEEKLY) SCDDAY(*SUN) +
                            SCDTIME(020000) +
                            RCVYACN(*NOSBM)

 If  you are saving directly  to tape, you will  want to ensure you have
 a tape  mounted when  you go  home Friday  evening.   A good  technique
 would be to  add another job schedule entry to send  a break message to
 a specific message queue:

              ADDJOBSCDE  JOB(SAVREMIND) CMD('SNDBRKMSG +
                            MSG('Mount a clean tape for +
                            Sunday *OPT21 backup.') +
                            TOMSGQ(xxxxx)) +
                            FRQ(*WEEKLY) SCDDAY(*FRI) +
                            SCDTIME(160000) +

 Virtual tape
 ------------

 The use of virtual tape offers several advantages such as:

   **   A  single tape device can be used  even if multiple volumes must
        be written.

   **   Media errors do not abort the save.

   **   Writing  to  tape   can  be  handled   by  normal  first   shift
        operational personnel.

   **   Multiple copies of the same backup media can be made easily.

 See the CRTVTP tool for simpler handling and explanation.

 Controlling subsystem
 ---------------------

 The SAVETYPE  *OPT21, *OPT22,  *OPT23, and  *TEST2 functions  all cause
 the  controlling  subsystem to  be  started at  completion  of  the job
 running SAVSYSBCH unless POWERDOWN(*YES) is specified.

 Starting the controlling subsystem causes  the program defined for  the
 QSTRUPPGM  system  value   to  be  run  which  normally   causes  other
 subsystems to be started as if an IPL has occurred.

 If  you have  specified POWERDOWN(*YES)  on SAVSYSBCH,  the controlling
 subsystem  does not start  and the system is  powered down.  Specifying
 RESTART(*YES) will cause the system to be powered up again.

 A900 0370 System Reference Code
 -------------------------------

 While running in  the restricted state caused  by a batch program,  the
 system will set the System Reference Code to A900 0370.

 If  the restricted state  lasts for  more than  the specified  time for
 RSDTIMLMT  value  (default  is  240  minutes),  the  system starts  the
 controlling subsystem.

 Handling of error conditions
 ----------------------------

 If  an  error  occurs,  the  STRSBS  command  is  used  to   start  the
 controlling subsystem.  STRSBS may fail with two typical conditions:

   **   CPF1099 Attempting  to end.   A prior request  has been  made to
        end  the  subsystem.   This  could occur  if  the  system cannot
        reach the  restricted  state and  is  still trying  to  end  the
        controlling subsystem when STRSBS is used.

   **   CPF1010 Already started.

 In  both cases,  the  job  waits 2  minutes  and re-tries  the  command
 again.   After 5 retries  (or if an unexpected  STRSBS error occurred),
 PWRDWNSYS *IMMED with RESTART(*YES) is used.

 The  intent is to  either complete the function  normally or ensure the
 system has been re-IPLed.

 SAVSYSBCH escape messages you can monitor for
 ---------------------------------------------

 None.  Escape messages from based on functions will be re-sent.

 SAVSYSBCH steps

 ---------------

 The command  would typically  be submitted  to  batch by  either a  job
 scheduling function or the time delay of SBMJOB (or DLYSBMJOB).

   **   A job log is forced by specifying CHGJOB LOG(4 0 *SECLVL).

   **   The  job   ensures  that  it  is  running   in  the  controlling
        subsystem.

   **   The  authority  for  *SAVSYS is  ensured.    The  command aborts
        without this special authority.

   **   The S/R defaults are accessed (See GO SAVE Option 20).

   **   The named Exit programs are checked for existence.

   **   If SAVETYPE(*TEST1)  is  specified, the  Exit programs  are  not
        run.   The TAACTL *DTAARA in  TAATOOL is saved.   The restricted
        state  is  not  requested  thus  allowing  the  function  to  be
        performed either interactively  or in batch.   The command  ends
        after the save occurs.

   **   For  other SAVETYPE  options, the  parameters  of SAVSYSBCH  are
        sent as messages to the job log.

   **   If an Exit 1 program is specified, it is called.

   **   ENDSBS is  used to enter the restricted state.   The command run
        is:

                 ENDSBS SBS(*ALL) OPTION(*IMMED) +
                          DELAY(300) BCHTIMLMT(xxx)

        where  the  BCHTIMLMT  value  from  the  RSDTIMLMT  parameter is
        used.

        The  *IMMED  option will  cause  the  system  to  end  any  jobs
        immediately.   The job  waits 5 minutes  before checking  to see
        if the restricted state has been reached.

        If  the restricted state has not been  reached, the job waits 60
        seconds and tries again.   This loop continues until either  the
        restricted state  is achieved  or the  RSDMIN limit is  reached.
        If  the limit  is reached, WRKACTJOB  is used  to list  the jobs
        which cannot  be  terminated  (along with  the  SAVSYSBCH  batch
        job), the controlling  subsystem is restarted, and the  job ends
        abnormally.

   **   If  the restricted  state is reached  and an  Exit 2  program is
        specified, it is called.

   **   If  SAVETYPE(*OPT21) is specified, the  TAA command CHKSAVDEV is
        run with  SEQ(1) and CLEAR(*ALL).   This  saves a single  object
        to  the media  at  sequence 1  with  an expiration  date of  the
        previous  day.   CHKSAVDEV  provides  a sanity  check  to ensure
        that the device  can be both  written to and  read and that  the
        save and restore operations are operating correctly.

        The  system program  QMNSAVE is  called to  do the  save.   This
        always  begins at  sequence 1 of  the media.   The last  step of
        the program runs STRSBS to start the controlling subsystem.

   **   If SAVETYPE(*OPT22) is specified,  the TAA command CHKSAVDEV  is
        run with  SEQ(1) and CLEAR(*ALL).   This  saves a single  object
        to  the media  at  sequence 1  with  an expiration  date  of the
        previous  day.   CHKSAVDEV  provides  a sanity  check  to ensure
        that the device  can be both  written to and  read and that  the
        save  and  restore  operations  are operating  correctly.    The
        system  program QSRSAVIA  is called  to do the  save.   The last
        step of  the  program  runs  STRSBS  to  start  the  controlling
        subsystem.

   **   If  SAVETYPE(*OPT23) is  specified, the  system program  QSRSAVU
        is called.   The last step  of the program runs  STRSBS to start
        the controlling subsystem.

   **   If  SAVETYPE(*TEST2)  is  specified,   the  TAACTL  *DTAARA   in
        TAATOOL is saved.   If the SAVOBJ command completes  normally or
        fails, the controlling subsystem is started.

   **   If an Exit 3 program is specified, it is called.

   **   The  TAA CHKSAVRST command  is optional and  may be run  with or
        without ERRORSONLY(*YES).

   **   The  TAA  PRTSAVLBL command  is  optional to  produce  a listing
        which can be used as an external label for the media.

   **   If POWERDOWN(*YES)  is  specified, PWRDWNSYS  is used  with  the
        RESTART parameter specified on SAVSYSBCH.

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

    SAVETYPE      The save type  to be used.  All  options except *TEST1
                  require  the restricted  state  which is  invoked when
                  SAVSYSBCH is run.

                  *OPT21 saves  all  system data,  user data,  IFS  data
                  etc.   This is a  full save  of the system  which uses
                  the  same  system  program  as  provided  for GO  SAVE
                  Option 21.    Prior  to  running  the  system  QMNSAVE
                  program, the  TAA CHKSAVDEV tool  is run to  provide a
                  sanity check of the device and S/R code.

                  *OPT22  saves the  system data  only.   This  uses the
                  same  system program  as provided  for GO  SAVE Option
                  22.   Prior to  running the  system QSRSAVIA  program,
                  the  TAA CHKSAVDEV  tool is  run to  provide  a sanity
                  check of the device and S/R code.

                  *OPT23  saves  the user  data .    This uses  the same
                  system program  as provided  for  GO SAVE  Option  23.
                  The program QSRSAVU is used to save the data.

                  *TEST1  is  a   testing  function  that  can   be  run
                  interactively  or in batch.   It does  not require the
                  restricted  state.    It  saves  one  object   (TAACTL
                  *DTAARA in  TAATOOL).  Any  exit programs  are checked
                  for existence,  but not run.  The  intent of *TEST1 is
                  to  let you become familiar  with SAVSYSBCH and ensure
                  that your save  device(s) are properly specified,  and
                  any Exit programs exist.

                  *TEST2  is  a  testing   function  that  requires  the
                  restricted  state.     It  saves  one  object  (TAACTL
                  *DTAARA in  TAATOOL).   The  intent  of *TEST2  is  to
                  allow  you  to  try  the full  function  of  the  tool
                  without  performing a  large  save operation.   STRSBS
                  of  the   controlling   subsystem  occurs   after   if
                  POWERDOWN is  not requested.   Exit  programs will  be
                  called  and the POWERDOWN  and RESTART  parameters are
                  valid.

    RSDMIN        The  number of  minutes to wait  before the restricted
                  state is achieved.   15 minutes  is the default.   The
                  value  entered  must be  between  10  minutes and  420
                  minutes (7 hours).

                  The  SAVSYSBCH command  begins by requesting  that all
                  subsystems be ended with the command:

                      ENDSBS SBS(*ALL) OPTION(*IMMED) +
                               BCHTIMLMT(xxx)

                  The  system  performs  an  immediate  cancel  of   any
                  active jobs (other than the SAVSYSBCH job).

                  If  the restricted  state cannot  be  achieved in  the
                  number  of  minutes specified,  WRKACTJOB  is  used to
                  produce  a  listing  of  the  jobs  which  are   still
                  active,  the  SAVSYSBCH command  ends  abnormally  and
                  the controlling subsystem is restarted.

    RSDTIMLMT     The  number of minutes  the system  can remain  in the
                  restricted  state.    240 (4  hours)  is  the default.
                  The value must be between 30 and 999.

                  If  the  value  is  exceeded,  the  system   ends  the
                  SAVSYSBCH  function   and  restarts   the  controlling
                  subsystem.

                  If  the requested save  operation completes before the
                  time  limit,  the  controlling  subsystem  is  started
                  which ends the restricted state.

    POWERDOWN     A  *YES/*NO option  for  whether  the system  will  be
                  powered down after the save is performed.

                  *NO  is the default.   The controlling subsystem would
                  be restarted  when  the job  running  SAVSYSBCH  ends.
                  This causes  the program  specified for the  QSTRUPPGM
                  system value to be run.

                  *YES may  be specified to power down  the system.  See
                  also  the RESTART  parameter.   If *YES  is specified,
                  the   power   down  occurs   after   EXIT3   and   the
                  CHKSAVRST/PRTSAVLBL options.

    RESTART       A  *YES/*NO option  for whether  the system  should be
                  restarted after a powerdown.

                  *NO is the default.

                  *YES  may  be specified  to restart  the  system after
                  the powerdown if  POWERDOWN(*YES) is  specified.   The
                  function runs by using PWRDWNSYS RESTART(*YES).

    EXIT1         An  optional program  to be  called  before ENDSBS  is
                  used  to enter the  restricted state.   If the library
                  qualifier  is  blank,  *LIBL  is  used  to  find   the
                  program.

                  The intent  of this parameter  is to allow  a function
                  such  as  sending  messages  to any  interactive  jobs
                  stating  that  the system  is  shutting down  and that
                  jobs will be  cancelled.  A  good command to  consider
                  is SNDBRKACT such as:

                               /* SNDBRKACT program */
                               PGM
                       TAATOOL/SNDBRKACT MSG('Please signoff.  We +
                                           are shutting down for +
                                           backup in 5 minutes.')
                               DLYJOB      DLY(300)
                               ENDPGM

    EXIT2         An   optional  program   to   be   called  after   the
                  restricted  state  is  reached  and  before  any saves
                  have begun.    If  the  library  qualifier  is  blank,
                  *LIBL is used to find the program.

    EXIT3         An  optional  program  to  be called  after  the  save
                  operations    are    completed    and    before    the
                  CHKSAVRST/PRTSAVLBL/POWERDOWN   options.      If   the
                  library  qualifier is  blank, *LIBL  is  used to  find
                  the program.

                  Because  the  use  of  the  system  programs  QMNSAVE,
                  QSRSAVIA,  and QSRSAVU tend  to specify ENDOPT(*LEAVE)
                  when saving, a  tape device may  need to be  unloaded.
                  You  could use  the  following TAA  command to  unload
                  the tape in an Exit 3 program.

              UNLOAD   DEV(xxx)

                  When  the SAVSYSBCH  job  ends (and  POWERDOWN(*NO) is
                  specified),  the   system   starts   the   controlling
                  subsystem.     This   invokes  the   program  in   the
                  QSTRUPPGM   system  value.     This   normally  starts
                  various system jobs as if an IPL had occurred.

    CHKSAVRST     An option for whether  the TAA Tool CHKSAVRST  command
                  should be run.

                  *ERRORSONLY and  *YES are  limited to  upper or  lower
                  case English  systems.  Use *NO if you  do not have an
                  English language option.

                  The   default   is   *ERRORSONLY   which   causes  the
                  CHKSAVRST command  to  be run  with  ERRORSONLY(*YES).
                  This  nets  out the  job  log  to  describe any  error
                  situations.

                  *YES  may  be  specified to  filter  out  some  of the
                  detail completion messages from the job log.

                  *NO  may  be  specified   to  prevent  the   CHKSAVRST
                  command.

    PRTSAVLBL     An option for  whether the TAA Tool  PRTSAVLBL command
                  should be run.

                  *YES  is  limited  to  upper  or  lower  case  English
                  systems.   Use  *NO if  you  do not  have  an  English
                  language option.

                  *YES causes  a label  to print  for each volume  saved
                  to that is intended to be attached to the media.

                  *NO  prevents the PRTSAVLBL  command from  being used.


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

 The   job  must  be  submitted  to  a  job  queue  in  the  controlling
 subsystem.

 You must have *SAVSYS special authority to use SAVSYSBCH.

 If the  media on the  specified devices cannot  hold the save  content,
 the command will fail.

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

 The following TAA Tools must be on your system:

      ADDDAT          Add date
      CHKRSDSTE       Check restricted state
      CHKSAVDEV       Check save device
      CHKSAVRST       Check save restore
      CHKSAVSYS       Check save system
      EDTVAR          Edit variable
      PRTSAVLBL       Print save label
      RTVIPLSTS       Retrieve IPL status
      SNDCOMPMSG      Send completion message
      SNDESCINF       Send escape information
      SNDESCMSG       Send escape message
      SNDJLGMSG       Send job log message

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

 None, the tool is ready to use.

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

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

    SAVSYSBCH     *CMD                   TAASAWN       QATTCMD
    TAASAWNC      *PGM       CLP         TAASAWNC      QATTCL

Added to TAA Productivity Tools October 15, 2009


Home Page

Powered by AS/400Powered by AS/400 Last modified on January 12, 2010 © 1995, 2010 - Jim Sloan, Inc.