AS/400 full-system backup can be completed only by executing backup commands in exclusive mode (Restrictive state) and on the console,
In exclusive mode, all user jobs and all subsystems have been stopped,
Only online real-time jobs of system jobs and those that enter the system (signon) from the central console can be executed normally,
Therefore, we can use the online real-time job on the central console to automatically execute the full-system backup job.
Practice: 1: Enter the system (signon) from the central console, execute the following commands, and read the message from the message queue in the program,
If there is no message in the message queue, the program will wait for the message to be read and determine whether to execute the full system backup job.
2: set a certain time in the scheduled job to send a message to the Message Queue to activate or terminate the backup job.
File: qclsrcmember: fulsavctype: clpusage:
1. added the Message Queue savsysmsgq: yourlib-specify your own library
Crtmsgq msgq (yourlib/savsysmsgq) text ('message queue for unattended full save ')
2. Modify yourlib in the program to specify your own library and console dsp01 -- specify your own console name
Crtclpgm fulsavc crtcmd cmd (fulsav) PGM (yourlib/fulsavc)
3. Added Automatic work schedule Transfer Activation Backup Message yourlib-specify your own library
This example specifies that this job is executed at every Sunday:
Addjobscde job (bigsav) cmd (sndmsg MSG ('strsavsys') tomsgq (yourlib/savsysmsgq ))
Frq (* weekly) content (* none) content (* Sun) ('16: 55: 00') jobq (qgpl/qbase)
User (qsecofr) text ('send a message to start full system save .')
To cancel a job, the CMD parameter of the preceding command is changed as follows:
Sndmsg MSG ('endsavsys ') tomsgq (yourlib/savsysmsgq)
4. Before leaving work on Friday, log on to the system from the console sign on and enter fulsav in the Command column. The system then enters the Backup Message Waiting for the above activation.
When every Sunday, the system will receive a message to determine whether to activate the backup job.
Note: because the data volume and tape capacity are different from those of the tape drive equipment, you may need to back up more than one volume of tape.
Manually change the tape. Before using this example, perform a test without any problems and then implement it.
**************************************** ***************************/
/****/
/****/
/** Title ......: weekly savsys & Full nonsys save (fulsavc )**/
/****/
/****/
/*************************************** ****************************/
/****/
/** To run an unattended savsys, you can add a Job scheduler **/
/** Entry as follows :**/
/****/
/** Sndmsg MSG ('strsavsyns') tomsgq (yourlib/savsysmsgq )**/
/****/
/** Specify the date and time you want the message to be sent .**/
/** You shoshould call this program from the console, and when **/
/** 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 specify Ming 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 '*/
/* 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 (* Policy)
/* Receive messages in the queue. Wait (* max) tells the system */
/* To wait for a message forever if no messages are in */
/* Queue. Once the message is already ed, 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 wocould not normally get to this point. If it does ,*/
/* It is because the message 'endsavsys 'has been already ed .*/
/* The job will now sign off for security .*/
Signoff log (* List)
Endpgm
/*************************************** ****************************/
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service