AQUI UN EJEMPLO DE UNA RUTINA SEMANAL.
SALUDOS.

-----Mensaje original-----
De: alex martinez [mailto:[EMAIL PROTECTED]
Enviado el: Mi�rcoles, 22 de Diciembre de 2004 07:51 a.m.
Para: [email protected]
Asunto: Re: Copias de seguridad total


una cosa mas, mejor que mirar la ayuda del menu SAVE para la opcion 21
recupera el programa CL QMNSAVE, que es el pgm utilizado por esta opc.

SAlu2


On Wed, 22 Dec 2004 13:39:28 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  
> Hola compa�eros, 
>  
> Quiero montarme un CL para hacer una copia completa cada domingo. He mirado
> en la ayuda de la opci�n 21 del men� GO SAVE y pone que realiza los
> siguientes mandatos: 
>  
> ENDSBS SBS(*ALL) OPTION(*IMMED)   
> SAVSYS                             
> SAVLIB LIB(*NONSYS) ACCPTH(*YES)   
> SAVDLO DLO(*ALL) FLR(*ANY)         
> SAV OBJ(('/*') ('/QSYS.LIB' *OMIT) 
>   ('/QDLS' *OMIT) UPDHST(*YES)     
> STRSBS SBSD(controlling-subsystem) 
>  
> Con los primeros ninguna duda pero hay uno que no entiendo y qeu el SEU
> tampoco ;-) y es este: 
>  
> SAV OBJ(('/*') ('/QSYS.LIB' *OMIT)  ('/QDLS' *OMIT) UPDHST(*YES)     
>  
> He intentado jugar con los parentesis, hacer F4 y buscar correspondencias y
> no lo encuentro. Est� mal la ayuda o es que estoy perdiendo facultades ;-) 
>  
> Gracias! 
> 
>  Sergi Sitjes
>  Resp. Sistemes d'Informaci�
>  GENEBRE, S.A.
>  E-mail: [EMAIL PROTECTED]
>  Web:   http://www.genebre.es
>  Tel:  +34 93 298 80 02
>  Fax: +34 93 298 80 07

_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________

Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]

 CL PROGRAM BIGSAV:
/*  *****************************************************************        */
/*  *                                                               *        */
/*  *  SYSTEM NAME..: RHM Frozen Utilities                          *        */
/*  *                                                               *        */
/*  *  PROGRAM......: BIGSAV                                        *        */
/*  *                                                               *        */
/*  *  AUTHOR.......: G. P. Skelton                                 *        */
/*  *                                                               *        */
/*  *  DATE.........: December 1998.                                *        */
/*  *                                                               *        */
/*  *  TITLE........: Weekly Savsys & Full Nonsys Save (BIGSAV)     *        */
/*  *                                                               *        */
/*  *                                                               *        */
/*  *****************************************************************        */
/*  *  MODIFICATION CONTROL                                         *        */
/*  *  ????????????????????                                         *        */
/*  *  MOD NO.   BY    DATE    DESCRIPTION                          *        */
/*  *  ????????? ??? ????????  ???????????????????????????????????? *        */
/*  *                                                               *        */
/*  *****************************************************************        */
/*  *****************************************************************        */
/*  *                                                               *        */
/*  *  To run an unattended SAVSYS, you can add a job scheduler     *        */
/*  *  entry as follows:                                            *        */
/*  *                                                               *        */
/*  *     SNDMSG MSG( 'STRSAVSYS' ) TOMSGQ( Yourlib/SAVSYSMSGQ)     *        */
/*  *                                                               *        */
/*  *  Specify the date and time you want the message to be sent.   *        */
/*  *  You should call this program from the console, and when the  *        */
/*  *  job scheduler sends the message the program will continue    *        */
/*  *  and perform the SAVSYS & full *NONSYS save followed by IPL.  *        */
/*  *                                                               *        */
/*  * Note that by sending message ENDSAVSYS you can cause this     *        */
/*  * program to end without performing the SAVSYS etc.             *        */
/*  *                                                               *        */
/*  *****************************************************************        */
             PGM

/*  *****************************************************************        */
/*  Declare Program Variables                                       *        */
/*  *****************************************************************        */

    DCL        VAR(&MSG)   TYPE(*CHAR) LEN(9)            /* Message          */
    DCL        VAR(&JOB)   TYPE(*CHAR) LEN(10)           /* This Job         */
    DCL        VAR(&COUNT) TYPE(*DEC)  LEN(4 0) VALUE(0) /* Retry            */


/*  *****************************************************************        */
/*  Main Processing                                                 *        */
/*  *****************************************************************        */

/*    Allocate the message queue to this job so it has exclusive   '         */
/*    use of the message queue so we can receive and remove       '          */
/*    messages from the queue. If we're unable to obtain the      '          */
/*    exclusive lock, then another job is using the queue and      '         */
/*    this job will cancel.                                        '         */
             ALCOBJ     OBJ((Yourlib/SAVSYSMSGQ *MSGQ *EXCL)) WAIT(0)
             MONMSG     MSGID(CPF0000) EXEC(SNDPGMMSG MSGID(CPF9897) +
                          MSGF(QCPFMSG) MSGDTA('Unable to allocate +
                          SAVSYS message queue.') TOUSR(*SYSOPR) +
                          MSGTYPE(*ESCAPE))

/*    Make sure that we are running on DSP01 (The Console)'                  */
/*    If we're not, this job will end when we do ENDSBS *ALL *IMMED!         */
             RTVJOBA    JOB(&JOB)
             IF         COND(&JOB *NE 'DSP01     ') THEN(SNDPGMMSG +
                          MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('DO +
                          IT ON THE CORRECT SCREEN YOU MUPPET!!!!') +
                          MSGTYPE(*ESCAPE))

/*    Remove any old messages from message queue                             */
             RMVMSG     MSGQ(Yourlib/SAVSYSMSGQ) CLEAR(*ALL)

/*    Change this job's message queues to *Hold so we don't get any.         */
             CHGJOB     LOGCLPGM(*YES) BRKMSG(*NOTIFY)
             CHGMSGQ    MSGQ(*USRPRF) DLVRY(*HOLD)
             MONMSG     MSGID(CPF2451)
             CHGMSGQ    MSGQ(*WRKSTN) DLVRY(*NOTIFY)


/*    Receive messages in the queue. WAIT(*MAX) tells the system             */
/*    to wait for a message forever if no messages are in the                */
/*    queue. Once the message is received, it will be removed.               */

Loop:

             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Waiting for somebody to tell me +
                          to start save of entire system........') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             RCVMSG     MSGQ(Yourlib/SAVSYSMSGQ) MSGTYPE(*ANY) +
                          WAIT(*MAX) RMV(*YES) MSG(&MSG)
             CHGJOB     STSMSG(*SYSVAL)

/*    If the message is neither STRSAVSYS or ENDSAVSYS, ignore               */
             IF         COND((&MSG *NE 'STRSAVSYS') *AND (&MSG *NE +
                          'ENDSAVSYS')) THEN(GOTO CMDLBL(LOOP))

/*    If the message is STRSAVSYS, continue with Saves                       */
             IF         COND(&MSG *EQ 'STRSAVSYS') THEN(DO)

/*    Send Start of wait Message to Qsysopr                                  */
             SNDPGMMSG  MSG(SAVSYS starting in 5 mins.) +
                          TOMSGQ(*SYSOPR)

/*    Send message to all users telling them to sign off                     */
             SNDPGMMSG  +                                              
                        MSG('                                       -
      ****** The Backups for tonight will start in 5 minutes...   +     
                      Please sign off the AS/400 +                 
                      Immediately.        *******') TOUSR(*ALLACT) 

/*  Delay job for next five minutes                                          */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Waiting for five minutes while  +
                          users sign off........................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             DLYJOB     DLY(300)
             CHGJOB     STSMSG(*SYSVAL)


/*    End all the subsystems                                                 */
Loop3:       SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Ending all the subsystems.....') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)




             ENDSBS     SBS(*ALL) OPTION(*IMMED)

/*  Delay job for next four minutes                                          */
             CHGJOB     STSMSG(*SYSVAL)
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Waiting for four minutes while  +
                          Subsystems are ended..................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             DLYJOB     DLY(240)

/*    Start SAVSYS                                                           */
             CHGJOB     STSMSG(*SYSVAL)
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Saving the system (SAVSYS)... +
                          ......................................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
/*  Loop 2 tries to do a savsys.  If the system is not yet in                */
/*  restricted state, a count is incremented, and the program waits          */
/*  another two minutes and tries again.                                     */
 LOOP2:      SAVSYS     DEV(TAP03) ENDOPT(*LEAVE) OUTPUT(*PRINT) +
                          CLEAR(*ALL)
             MONMSG     MSGID(CPF3785) EXEC(DO)
               CHGVAR     VAR(&COUNT) VALUE(&COUNT + 1)

/*  If we have retried 12 times (24 minutes), NYCOMSGR is started and        */
/*  a message is sent to QSYSOPR to be paged out.  The program then          */
/*  loops to LOOP3 to attempt Endsbs *all *immed again.                      */
               IF         COND(&COUNT *GE 12) THEN(DO)
                 STRSBS     SBSD(NYCOMSGR)
                 DLYJOB     DLY(120)
                 SNDMSG     MSG('The system wont go down on me!!') +
                              TOUSR(*SYSOPR)
                 GOTO       CMDLBL(LOOP3)
               ENDDO

               DLYJOB     DLY(120)
               GOTO       CMDLBL(LOOP2)
             ENDDO

             CHGJOB     STSMSG(*SYSVAL)

/*    Start SAVLIB *NONSYS                                                   */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Saving all the user libraries +
                          (SAVLIB *NONSYS).....................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             SAVLIB     LIB(*NONSYS) DEV(TAP03) ENDOPT(*LEAVE) +
                          CLEAR(*AFTER) ACCPTH(*YES) OUTPUT(*PRINT)
             MONMSG     MSGID(CPF3777) EXEC(SNDMSG MSG('Not All +
                          objects Saved On Sunday Night!!!! Look at +
                          log of job DSP01') TOMSGQ(GSKELTON +
                          ACUSWORTH JBARRY DCOLAM DSTEER))
             CHGJOB     STSMSG(*SYSVAL)

/*    Start SAVDLO                                                           */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Saving all Document libraries +
                          (SAVDLO DLO(*ALL)....................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             SAVDLO     DLO(*ALL) FLR(*ANY) DEV(TAP03) +
                          ENDOPT(*LEAVE) OUTPUT(*PRINT) CLEAR(*AFTER)
             CHGJOB     STSMSG(*SYSVAL)

/*    Start save of all directory objects                                    */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Saving all Directory objects (SAV +
                          OBJ((''/*'')......................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             SAV        DEV('/QSYS.LIB/TAP03.DEVD') OBJ(('/*') +
                          ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT)) +
                          OUTPUT(*PRINT) ENDOPT(*UNLOAD) +
                          UPDHST(*YES) CLEAR(*AFTER)
             CHGJOB     STSMSG(*SYSVAL)

/*    Apply PTFs permanently                                                 */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Applying PTFs.................... +
                          ..................................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             APYPTF     LICPGM(*ALL) APY(*PERM) DELAYED(*YES)
             MONMSG     MSGID(CPF3660)
             CHGJOB     STSMSG(*SYSVAL)


/*    Power Down the System                                                  */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA('Powering down the system......... +
                          ..................................') +
                          TOPGMQ(*EXT) MSGTYPE(*STATUS)
             CHGJOB     STSMSG(*NONE)
             PWRDWNSYS  OPTION(*IMMED) RESTART(*YES)
             CHGJOB     STSMSG(*SYSVAL)

             ENDDO

/*    The program would not normally get to this point.  If it does,         */
/*    it is because the message 'ENDSAVSYS' has been received.               */
/*    The job will now sign off for security.                                */

             SIGNOFF    LOG(*LIST)

             ENDPGM
/*  *****************************************************************        */


Command source for command BIGSAV:

CMD        PROMPT('Unattended Full System Save')


Create Message Queue SAVSYSMSGQ:

CRTMSGQ MSGQ(Yourlib/SAVSYSMSGQ) TEXT('Message Queue for Unattended full save')

Add a Job Schedule Entry.  In my example, the job will run at 16:55 each Sunday:

ADDJOBSCDE JOB(BIGSAV) CMD(SNDMSG MSG('STRSAVSYS') TOMSGQ(QSYSTSF/SAVSYSMSGQ)) 
FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*SUN) SCDTIME('16:55:00') JOBQ(QGPL/QBASE) 
USER(QSECOFR) TEXT('Send a message to start full system save.')

Also, if you wish to cancel the save and don't have access to the console, 
simple send the job a message to cancel by the following command...

SNDMSG MSG( 'ENDSAVSYS' ) TOMSGQ( Yourlib/SAVSYSMSGQ)   

Responder a