News Stay informed about the latest enterprise technology news and product updates.

Hot-swapping a job's USRPRF -- Code

Hot-swapping a job's USRPRF --

  /* OVRPRF  */


             CMD        PROMPT('Override Current User profile')      
             PARM       KWD(USRPRF) TYPE(*SNAME) LEN(10) MIN(1) +    
                          PROMPT('Override to User Profile')         
             PARM       KWD(PSSWRD) TYPE(*CHAR) LEN(10) MIN(1) +     
                          DSPINPUT(*NO) PROMPT('Password')           

***************************************

/* OVRPRF */


             PGM        PARM(&PROFILE &PSSWRD)                         
                                                                       
                                                                       
             DCL        VAR(&PROFILE) TYPE(*CHAR) LEN(10)              
             DCL        VAR(&ORIGPRF) TYPE(*CHAR) LEN(10)              
             DCL        VAR(&CURPRF) TYPE(*CHAR) LEN(10)               
             DCL        VAR(&PSSWRD) TYPE(*CHAR) LEN(10)               
             DCL        VAR(&HANDLE) TYPE(*CHAR) LEN(12)               
                                                                       
                                                                       
             RTVDTAARA  DTAARA(*LDA (1001 10)) RTNVAR(&ORIGPRF)        
             RTVUSRPRF  RTNUSRPRF(&CURPRF)                             
                                                                       
             IF COND(&ORIGPRF *NE '          ') THEN(DO)               
                 SNDPGMMSG MSG('Override already set') +               
                      MSGTYPE(*DIAG)                                   
                GOTO       CMDLBL(END)                              
            ENDDO                                                   
                                                                    
            IF COND(((&PSSWRD *EQ '*NOPWD') *OR +                   
                    (&PSSWRD *EQ '*NOPWDCHK')) *AND +               
                    (&CURPRF *NE 'QSECOFR')) THEN(DO)               
                SNDPGMMSG MSG('Invalid password') +                 
                     MSGTYPE(*DIAG)                                 
                GOTO       CMDLBL(END)                              
            ENDDO                                                   
                                                                    
            RTVUSRPRF  RTNUSRPRF(&ORIGPRF)                          
            CHGDTAARA  DTAARA(*LDA (1001 10)) VALUE(&ORIGPRF)       
                                                                    
            CALL       PGM(QSYGETPH) PARM(&PROFILE &PSSWRD &HANDLE) 
            MONMSG     MSGID(CPF0000 CPF9999 MCH0000) +             
                      EXEC(DO)                                       
                      SNDPGMMSG MSG('Invalid profile or +            
                          password') MSGTYPE(*DIAG)                  
                      GOTO       CMDLBL(END)                         
                      ENDDO                                          
                                                                     
             CALL       PGM(QWTSETP) PARM(&HANDLE)                   
             CHGDTAARA  DTAARA(*LDA (1011 12)) VALUE(&HANDLE)        
                                                                     
 END:        ENDPGM                                                  
***************************************

                         Display Command Information                         
                                                                             
Command  . . . . . . . :   OVRPRF        Library  . . . . . . . :   ROB      
                                                                             
Program to process command . . . . . . :   OVRPRF                            
  Library  . . . . . . . . . . . . . . :     *LIBL                           
  State used to call program . . . . . :     *USER                           
Source file  . . . . . . . . . . . . . :   QCMDSRC                           
  Library  . . . . . . . . . . . . . . :     ROB                             
Source file member . . . . . . . . . . :   OVRPRF                            
Validity checking program  . . . . . . :   *NONE                             
Mode(s) in which valid . . . . . . . . :   *PROD                             
                                           *DEBUG                            
                                           *SERVICE                          
Where allowed to run . . . . . . . . . :   *IMOD      *BMOD      *IREXX      
                                           *BREXX     *BPGM      *IPGM       
                                           *EXEC      *INTERACT  *BATCH      
Allow limited user . . . . . . . . . . :   *NO                               
Maximum positional parameters  . . . . :   *NOMAX                            
Message file for prompt text . . . . . :   *NONE                           
Message file . . . . . . . . . . . . . :   QCPFMSG                         
  Library  . . . . . . . . . . . . . . :     *LIBL                         
Current library  . . . . . . . . . . . :   *NOCHG                          
Product library  . . . . . . . . . . . :   *NOCHG                          
Bookshelf  . . . . . . . . . . . . . . :   *NONE                           
Help panel group . . . . . . . . . . . :   *NONE                           
Help identifier  . . . . . . . . . . . :   *NONE                           
Help search index  . . . . . . . . . . :   *NONE                           
Prompt override program  . . . . . . . :   *NONE                           
Enabled for graphical user interface . :   *NO                             
Threadsafe . . . . . . . . . . . . . . :   *NO                             
Multithreaded job action . . . . . . . :   *SYSVAL                         
Coded character set ID . . . . . . . . :   37                              
Text . . . . . . . . . . . . . . . . . :   Override User Profile      

*************************************

/* DLTOVRPRF */


             CMD        PROMPT('Delete User Profile Override')      

*************************************

/* DLTOVRPRF */

PGM                                                                    
                                                                       
DCL &PROFILE *CHAR 10                                                  
                                                                       
                                                                       
RTVDTAARA DTAARA(*LDA (1001 10)) RTNVAR(&PROFILE)                      
                                                                       
IF (&PROFILE = ' ') DO                                                 
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('No +      
                          override currently in force') MSGTYPE(*DIAG) 
                                                                       
GOTO END                                                               
ENDDO                                                                  
                                                                       
DLTOVRPRFX ?*USRPRF(&PROFILE) ??PSSWRD( )                              
MONMSG MSGID(CPF6801) EXEC(GOTO END)                                   
MONMSG MSGID(CPF0000 CPF9999 MCH0000) EXEC(DO)                      
                      SNDPGMMSG MSG('Invalid password') +           
                         MSGTYPE(*DIAG)                             
                      ENDDO                                         
                                                                    
                                                                    
END: ENDPGM                                                         

*************************************

                         Display Command Information                           
                                                                               
Command  . . . . . . . :   DLTOVRPRF     Library  . . . . . . . :   ROB        
                                                                               
Program to process command . . . . . . :   DLTOVRPRF                           
  Library  . . . . . . . . . . . . . . :     *LIBL                             
  State used to call program . . . . . :     *USER                             
Source file  . . . . . . . . . . . . . :   QCMDSRC                             
  Library  . . . . . . . . . . . . . . :     ROB                               
Source file member . . . . . . . . . . :   DLTOVRPRF                           
Validity checking program  . . . . . . :   *NONE                               
Mode(s) in which valid . . . . . . . . :   *PROD                               
                                           *DEBUG                              
                                           *SERVICE                            
Where allowed to run . . . . . . . . . :   *IMOD      *BMOD      *IREXX        
                                           *BREXX     *BPGM      *IPGM         
                                           *EXEC      *INTERACT  *BATCH        
Allow limited user . . . . . . . . . . :   *NO                                 
Maximum positional parameters  . . . . :   *NOMAX                              
Message file for prompt text . . . . . :   *NONE                              
Message file . . . . . . . . . . . . . :   QCPFMSG                            
  Library  . . . . . . . . . . . . . . :     *LIBL                            
Current library  . . . . . . . . . . . :   *NOCHG                             
Product library  . . . . . . . . . . . :   *NOCHG                             
Bookshelf  . . . . . . . . . . . . . . :   *NONE                              
Help panel group . . . . . . . . . . . :   *NONE                              
Help identifier  . . . . . . . . . . . :   *NONE                              
Help search index  . . . . . . . . . . :   *NONE                              
Prompt override program  . . . . . . . :   *NONE                              
Enabled for graphical user interface . :   *NO                                
Threadsafe . . . . . . . . . . . . . . :   *NO                                
Multithreaded job action . . . . . . . :   *SYSVAL                            
Coded character set ID . . . . . . . . :   37                                 
Text . . . . . . . . . . . . . . . . . :   Delete Override User Profile        


*************************************

/* DLTOVRPRFV */

PGM (&PSSWRD)                                                          
DCL &ORIGPRF *CHAR 10                                                  
DCL &PSSWRD *CHAR 10                                                   
DCL &HANDLE *CHAR 12                                                   
                                                                       
                                                                       
RTVDTAARA DTAARA(*LDA (1014 10)) RTNVAR(&ORIGPRF)                      
                                                                       
CALL QSYGETPH (&ORIGPRF &PSSWRD &HANDLE)                               
MONMSG CPF0000 EXEC(DO)                                                
             SNDPGMMSG  MSGID(CPD0006) MSGF(QCPFMSG) +                 
                          MSGDTA('0000Invalid password') +             
                          MSGTYPE(*DIAG)                               
             SNDPGMMSG  MSGID(CPF0002) MSGF(QCPFMSG) +                 
                          MSGTYPE(*ESCAPE)                             
                                                                       
                                                                     
GOTO END                                                             
ENDDO                                                                
                                                                     
CALL QSYRLSPH (&HANDLE)                                              
                                                                     
END: ENDPGM                                                          

**************************************

/* DLTOVRPRFX  */


CMD PROMPT('Delete Override to USRPRF')                                
PARM KWD(USRPRF) TYPE(*SNAME) LEN(10) MIN(1) PROMPT('Reset Profile')   
PARM KWD(PSSWRD) TYPE(*CHAR) LEN(10) MIN(1) DSPINPUT(*NO) +            
PROMPT('Password')                                                    

*************************************

/* DLTOVRPRFX */

PGM (&USRPRF &PSSWRD)                                                  
DCL &USRPRF *CHAR 10                                                   
DCL &PSSWRD *CHAR 10                                                   
DCL &HANDLE *CHAR 12                                                   
CALL QSYGETPH (&USRPRF &PSSWRD &HANDLE)                                
             MONMSG     MSGID(CPF0000 CPF9999 MCH0000) +               
                      EXEC(DO)                                         
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Invalid + 
                          password') MSGTYPE(*ESCAPE)                  
                      GOTO       CMDLBL(END)                           
                      ENDDO                                            
                                                                       
CALL QWTSETP (&HANDLE)                                                 
             RTVDTAARA  DTAARA(*LDA (1011 12)) RTNVAR(&HANDLE)         
CALL QSYRLSPH (&HANDLE)                                                
             CHGDTAARA  DTAARA(*LDA (1001 22)) VALUE(' ')              
END:                                                                  
ENDPGM                                                                

************************************

                         Display Command Information                           
                                                                               
Command  . . . . . . . :   DLTOVRPRFX    Library  . . . . . . . :   ROB        
                                                                               
Program to process command . . . . . . :   DLTOVRPRFX                          
  Library  . . . . . . . . . . . . . . :     *LIBL                             
  State used to call program . . . . . :     *USER                             
Source file  . . . . . . . . . . . . . :   QCMDSRC                             
  Library  . . . . . . . . . . . . . . :     ROB                               
Source file member . . . . . . . . . . :   DLTOVRPRFX                          
Validity checking program  . . . . . . :   *NONE                               
Mode(s) in which valid . . . . . . . . :   *PROD                               
                                           *DEBUG                              
                                           *SERVICE                            
Where allowed to run . . . . . . . . . :   *IMOD      *BMOD      *IREXX        
                                           *BREXX     *BPGM      *IPGM         
                                           *EXEC      *INTERACT  *BATCH        
Allow limited user . . . . . . . . . . :   *NO                                 
Maximum positional parameters  . . . . :   *NOMAX                              
Message file for prompt text . . . . . :   *NONE                             
Message file . . . . . . . . . . . . . :   QCPFMSG                           
  Library  . . . . . . . . . . . . . . :     *LIBL                           
Current library  . . . . . . . . . . . :   *NOCHG                            
Product library  . . . . . . . . . . . :   *NOCHG                            
Bookshelf  . . . . . . . . . . . . . . :   *NONE                             
Help panel group . . . . . . . . . . . :   *NONE                             
Help identifier  . . . . . . . . . . . :   *NONE                             
Help search index  . . . . . . . . . . :   *NONE                             
Prompt override program  . . . . . . . :   *NONE                             
Enabled for graphical user interface . :   *NO                               
Threadsafe . . . . . . . . . . . . . . :   *NO                               
Multithreaded job action . . . . . . . :   *SYSVAL                           
Coded character set ID . . . . . . . . :   37                                
Text . . . . . . . . . . . . . . . . . :   Delete Override Profile (2) 

Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close