IBM Support

Creating a Program to Save the Operating System

Troubleshooting


Problem

This document tells how to create a program to save the operating system.

Resolving The Problem

Disclaimer: This document contains code made available by IBM Corporation on an as is basis. Anyone receiving this document is considered to be licensed under IBM copyrights to use the IBM-provided source code in any way he or she deems fit, including copying it, compiling it, modifying it, and redistributing it, with or without modifications. No license under any IBM patents or patent applications is to be implied from this copyright license.

Caution: The command that saves the licensed internal code and operating system (SAVSYS) must be called from the console at V5R2 and below. At V5R3 and above, the BCHTIMLMT parameter was added to the ENDSBS command allowing a restricted state backup to be run in Batch.

A user of the document should understand that IBM cannot provide technical support for the document and will not be responsible for any consequences of use of the program.

The following is a sample program that might help you in creating your own program:


    The following example CL program allows you to schedule and run an
   unattended
SAVSYS command without operator intervention.
 
   This program needs to run from the console.  Once the program is called,
   the console is not available for use until the program completes.


Example

        *************** Beginning of data ******************************************
0001.00 PGM         PARM(&TIME)                                                    
0002.00             DCL         VAR(&TIME) TYPE(*CHAR) LEN(6)                      
0003.00             DCL         VAR(&LOOPCNT) TYPE(*DEC) LEN(3 0) VALUE(1)          
0004.00             DCL         VAR(&MESSAGE) TYPE(*CHAR) LEN(7)                    
0005.00             DCL         VAR(&CANCEL) TYPE(*CHAR) LEN(1)                    
0006.00             DCL         VAR(&MSGTXT) TYPE(*CHAR) LEN(1)                    
0007.00             MONMSG      MSGID(CPF0000)                                      
0008.00                                                                            
0009.00            DLYJOB      RSMTIME(&TIME)                                      
0010.00            MONMSG      MSGID(CPF0001) EXEC(GOTO CMDLBL(EXIT))              
0011.00                                                                            
0012.00            CHGMSGQ     MSGQ(QSYSOPR) DLVRY(*BREAK) SEV(99)                  


0013.00        /****************************************************************/  
0014.00        /*COMMANDS TO END APPLICATIONS AND SUBSYSTEMS GRACEFULLY        */  
0015.00        /****************************************************************/  
0016.00           SNDBRKMSG   MSG('SUBSYSTEMS ENDING IN 1 MINUTE.  PLEASE SIGN OFF +
0017.00                         IMMEDIATELY.') TOMSGQ(*ALLWS)  
0018.00            MONMSG      MSGID(CPF0000)        
0019.00            DLYJOB      DLY(60)  
0020.00            ENDTCPSVR   SERVER(*ALL)
0021.00            MONMSG      MSGID(TCP0000)
0022.00            ENDHOSTSVR  SERVER(*ALL)
0023.00            MONMSG      MSGID(TCP0000)

0024.00            DLYJOB      DLY(120)
0025.00            ENDTCP      OPTION(*IMMED)
0026.00            MONMSG      MSGID(TCP0000)
0027.00            DLYJOB      DLY(120)                        
0028.00            ENDSBS      SBS(*ALL) OPTION(*IMMED)  
0029.00                                                                              
0030.00       /******************************************************************/    

0031.00       /* THE FOLLOWING LOOP WILL RUN TO ENSURE THAT THE SUBSYSTEMS HAVE */    
0032.00       /* ENDED OR INQUIRY MESSAGE CPA3712 WILL BE POSTED                */    
0033.00       /******************************************************************/    
0034.00 LOOP:                                                                        
0035.00            ENDSBS       SBS(*ALL) OPTION(*IMMED)                              
0036.00            MONMSG       MSGID(CPF1035) EXEC(DO)                              
0037.00              RCVMSG       MSGTYPE(*EXCP) RMV(*YES)                            
0038.00              IF COND(&LOOPCNT *LT 119) THEN(DO)                              
0039.00              DLYJOB       DLY(15)  

0040.00              CHGVAR &LOOPCNT (&LOOPCNT + 1)                                           
0041.00              GOTO         CMDLBL(LOOP)                                        
0042.00              ENDDO                                                            
0043.00              ELSE CMD(GOTO CMDLBL(CPA3712))                                  

0044.00              ENDDO                                                            
0045.00                                                                              
0046.00           SAVSYS       DEV(TAP01)                                            
0047.00                                                                              
0048.00                                                                              
0049.00 CPA3712:                                                                      
0050.00             QSYS/SNDPGMMSG MSGID(CPA3712) MSGF(*LIBL/QCPFMSG) TOPGMQ(*EXT) -
0051.00                               MSGTYPE(*INQ)                                
0052.00             QSYS/RCVMSG PGMQ(*SAME) MSGQ(*PGMQ) MSGTYPE(*RPY) WAIT(*MAX) -  
0053.00                               RMV(*YES) MSG(&MSGTXT)                        
0054.00             IF COND(%SST(&MSGTXT 1 1) *EQ 'G') THEN(DO)                    
0055.00             QSYS/CHGVAR VAR(&LOOPCNT) VALUE(1)                              

0056.00             GOTO CMDLBL(LOOP)                                              
0057.00             ENDDO                                                          
0058.00             ELSE CMD(DO)                                                    
0059.00             QSYS/CHGVAR VAR(&MESSAGE) VALUE(CPF2361)                        
0060.00             QSYS/CHGVAR VAR(&CANCEL) VALUE('N')                            
0061.00             GOTO CMDLBL(EXIT)                                              
0062.00             ENDDO                                                          
0063.00                                                                            
0064.00 CLEANUP:                                                                    
0065.00                                                                            
0066.00  /*****************************************************************/        
0067.00  /*START SUBSYSTEMS AND ANY OTHER START UP PROCESSES    */                  
0068.00  /*****************************************************************/        

0069.00             STRSBS       SBSD(QSYS/QCTL)                                    
0070.00                                                              
0071.00             CHGMSGQ      MSGQ(QSYSOPR) DLVRY(*NOTIFY) SEV(0)
0072.00                                                              
0073.00 EXIT:                                                        
0074.00                                                              
0075.00 ENDPGM                                                      
0076.00                                                              
       ****************** End of data ******************************  

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Historical Number

7425108

Document Information

Modified date:
18 December 2019

UID

nas8N1010299