Sauvegarde-AS400

Jean-Pierre Laroche


Laroche.jeanpierre@gmail.com




TRAITEMENT *BATCH *INTERACTIF de la commande go SAV option 21


IBM400 * AS400 V5R4


ATTENTION àla cmd pwrdwsys en v6r1 elle peut posée des prblm


CRTDTAARA DTAARA(CONFIG/SAVFULL) TYPE(*CHAR) LEN(25)

VALUE('0000000000000000000000000')

TEXT('Top de fonction SAVE *FULL ( GO SAV-21)')           


crt source  savfull  CMD        PROMPT('STOP AS400 & SAUVEGARDE SAV-21')

CRTCMD CMD(CONFIG/SAVFULL) PGM(CONFIG/SAVFULL)



la variable Savfull position 25 en bacth peut etre active par un autre job

exemple

pwrd00 programme de nuit

(qui controle la cloture des travaux de nuit avant de faire pwrdwnsys )

soumet savfull change la dataara -> '2'

puis goto fin

le pgm savfull feras lui le pwrdwnsys et lors du redemarage la procedure de jour seras

declenche dans le pgm de la variable QSTRUPPGM


PGM

/*----------------------------------------------------------------------------+

POSSIBILITE DE GERER LA DATE ET H:MN POSITION 13-YYMMDD 21-HH 23-MN           +

POSITION 25 TOP D'ACTIVITÉ                                                    +

POSITION 1-12 TOP DE SUIVI DE TRAIEMENT                                       +

DUPLIQUEr USRPRF QSECOFR EX: CONFIG (POUR AVOIR LES DROITS)                   +

CRTCMD SAVFULL                                                                +

EXEMPLE                                                                       +

SBMJOB DANS VOS APPLICATIONS                                                  +

SBMJOB CMD(CONFIG/SAVFULL) JOB(SAVFULL)                                       +

JOBD(JOBDSTD) JOBQ(QCTL) OUTQ(QPRINT) USER(CONFIG)                            +

DLYJOB DLY(20)                                                                +

CHGDTAARA DTAARA(SAVFULL (25 1)) VALUE('2')                                   + 

                                                                              +

SINON EN INTERACTIF EXECUTER LA CMD SAVFULL SUR LA CONSOLE                    + ------------------------------------------------------------------------------*/

DCL &TRT *CHAR 1

DCL &JOB *CHAR 10

DCL &USER *CHAR 10

DCL &QCONSOLE *CHAR 10


CHGJOB OUTQ(QPRINT)

CHGJOB LOG(4 0 *MSG) LOGCLPGM(*YES)


CHGDTAARA DTAARA(CONFIG/SAVFULL (25 1)) VALUE('1')

CHGDTAARA DTAARA(CONFIG/SAVFULL (1 12)) VALUE('000000000000')

RTVSYSVAL SYSVAL(QCONSOLE) RTNVAR(&QCONSOLE)


RTVJOBA JOB(&JOB) USER(&USER) /*----------------------------------------------------------------------------*/

/* CONTROLE D'UTILISATION DU TRAITEMENT SAVFULL                               */ /*----------------------------------------------------------------------------*/

IF (&JOB *NE &QCONSOLE *AND &JOB *NE 'SAVFULL' ) DO

SNDMSG MSG('Traitement impossible de la commande +

SAVFULL') TOMSGQ(*SYSOPR)   

                                        GOTO FIN ENDDO

IF (&USER *NE 'CONFIG' *AND &USER *NE 'QSECOFR') DO

SNDMSG MSG('Traitement impossible de la commande +

*USER Invalide SAVFULL') + TOMSGQ(*SYSOPR)

                                        GOTO FIN ENDDO /*----------------------------------------------------------------------------*/

IF (&JOB *EQ &QCONSOLE ) + CHGDTAARA DTAARA(CONFIG/SAVFULL (25 1)) VALUE('2') /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/


/* INIT - OK */

CHGDTAARA DTAARA(CONFIG/SAVFULL (1 1)) VALUE('1')


/*----------------------------------------------------------------------------*/

RE: RTVDTAARA DTAARA(CONFIG/SAVFULL (25 1)) RTNVAR(&TRT)


IF (&TRT = '2') DO


/* TAPEZ G POUR POURSUIVRE LA SAUVEGARDE */

ADDRPYLE SEQNBR(9999) MSGID(CPA3708) RPY('G')

MONMSG CPF0000 CHGDTAARA DTAARA(CONFIG/SAVFULL (2 1)) VALUE('1')



/* SYSTEM RESTREINT CHG.DFT MSG */


IF (&QCONSOLE *EQ &JOB) DO

CHGJOB INQMSGRPY(*SYSRPYL) BRKMSG(*NOTIFY)

ENDSBS SBS(*ALL) OPTION(*IMMED) ENDSBSOPT(*NOJOBLOG)

                        ENDDO

ELSE                    DO

CHGJOB INQMSGRPY(*SYSRPYL)

ENDSBS SBS(*ALL) OPTION(*IMMED) ENDSBSOPT(*NOJOBLOG) BCHTIMLMT(220) /* 3H30 */

                        ENDDO

CHGDTAARA DTAARA(CONFIG/SAVFULL (3 1)) VALUE('1')

DLYJOB DLY(300)



/* INITIALISE LA BANDE */

INZTAP DEV(TAP01) NEWVOL(SVFULL) CHECK(*NO) CLEAR(*NO)

CHGDTAARA DTAARA(CONFIG/SAVFULL (4 1)) VALUE('1')


/* MICROCODE + QSYS + SAVSECDTA + SAVCFG */

/* CPF3785 ENDSBS *ALL NON TERMINÉ ATTENDRE 60 SECONDE */


RSYS: SAVSYS DEV(TAP01) ENDOPT(*LEAVE)

MONMSG MSGID(CPF3785)  EXEC(DO)

DLYJOB DLY(60)

GOTO RSYS

                            ENDDO

CHGDTAARA DTAARA(CONFIG/SAVFULL (5 1)) VALUE('1')



/* BIBLIOTHEQUES *ALL USER , QGPL, QUSRSYS, LOGICIELS SOUS LICENCE */

/* SPOOL-*YES CHEMIN D'ACCES-*YES */


SAVLIB LIB(*NONSYS) DEV(TAP01) ENDOPT(*LEAVE) +

ACCPTH(*YES) SPLFDTA(*ALL)


CHGDTAARA DTAARA(CONFIG/SAVFULL (6 1)) VALUE('1')



/* FOLDER INSCRIT DANS QDLS ET *IBM */


SAVDLO DLO(*ALL) FLR(*ANY) DEV(TAP01) ENDOPT(*LEAVE)

CHGDTAARA DTAARA(CONFIG/SAVFULL (7 1)) VALUE('1')



/* LE RESTE DE L'IFS */


SAV DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('/*') +

('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT)) UPDHST(*YES)


CHGDTAARA DTAARA(CONFIG/SAVFULL (8 1)) VALUE('1')



/* RELACHE LA BANDE */

CHKTAP DEV(TAP01) ENDOPT(*UNLOAD)

CHGDTAARA DTAARA(CONFIG/SAVFULL (9 1)) VALUE('1')



/* REMOVE REPONSE MSG SAUVEGARDE */

RMVRPYLE SEQNBR(9999)

MONMSG CPF0000

CHGDTAARA DTAARA(CONFIG/SAVFULL (10 1)) VALUE('1')



/* REMET A *ZEROS LE TOP SAVFULL */

CHGDTAARA DTAARA(CONFIG/SAVFULL (25 1)) VALUE('0')



/* FERME LE SYSTEM ET REDEMARAGE AVEC PROCEDURE NORMALE */

PWRDWNSYS OPTION(*IMMED) RESTART(*YES)


ENDDO


DLYJOB DLY(60)

GOTO RE


/*----------------------------------------------------*/

FIN: ENDPGM



Copyright © <2009>, <Laroche Jean-Pierre>

Created with the Freeware Edition of HelpNDoc: Easily create Help documents