PGM PARM(&SYSTEM03 &SYSTEM04)                                                   
  DCL        VAR(&SYSTEM03) TYPE(*CHAR) LEN(10)                                 
  DCL        VAR(&SYSTEM04) TYPE(*CHAR) LEN(10)                                 
  DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(512)                                  
  DCL        VAR(&QSHCMD) TYPE(*CHAR) LEN(512)                                  
  DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)                                     
  DCL        VAR(&SSHKEY) TYPE(*CHAR) LEN(100)                                  
  DCL        VAR(&USER) TYPE(*CHAR) LEN(10)                                     
  DCLF       FILE(QSHSTDOUT) RCDFMT(QSHSTDOUT)                                  
/* ************************************************************************** */
/* GLOBAL MESSAGE MONITOR                                                     */
/* ************************************************************************** */
  MONMSG     MSGID(CPF0000 RPG0000 QRG0000 RSF0000 +                            
               MCH0000) EXEC(GOTO CMDLBL(##ERROR))                              
  GOTO       CMDLBL(##NOERROR)                                                  
##ERROR:                                                                        
  MOVDIAGMSG                                                                    
  MONMSG     MSGID(CPF0000)                                                     
  RSNESCMSG                                                                     
  MONMSG     MSGID(CPF0000)                                                     
  RETURN                                                                        
##NOERROR:                                                                      
/* ************************************************************************** */
/* MAINLINE:                                                                  */
/* ************************************************************************** */
  RTVJOBA    USER(&USER)                                                        
  CHGVAR     VAR(&SSHKEY) VALUE('/home/' *TCAT &USER +                          
               *TCAT '/.ssh/id_rsa.pub')                                        
  CHKIFSOBJ  OBJ(&SSHKEY)                                                       
  MONMSG     MSGID(CPF9897) EXEC(DO)                                            
    CHGVAR     VAR(&MSGDTA) VALUE('You are not set up to +                      
                 use SSH sessions with the HMC.')                               
    SNDPGMMSG MSGID(CPF9898) +                                                  
                MSGF(QCPFMSG) MSGDTA(&MSGDTA) +                                 
                MSGTYPE(*ESCAPE)                                                
  ENDDO                                                                         
  CRTPF      FILE(QTEMP/QSHSTDOUT) RCDLEN(512) 
      MONMSG     MSGID(CPF7302) EXEC(DO)                               
    CLRPFM     FILE(QTEMP/QSHSTDOUT)                               
    MONMSG     MSGID(CPF0000)                                      
  ENDDO                                                            
  CRTPF      FILE(QTEMP/QSHSTDOUT2) RCDLEN(512)                    
  MONMSG     MSGID(CPF7302) EXEC(DO)                               
    CLRPFM     FILE(QTEMP/QSHSTDOUT2)                              
    MONMSG     MSGID(CPF0000)                                      
  ENDDO                                                            
  OVRDBF     FILE(STDOUT) TOFILE(QTEMP/QSHSTDOUT) OVRSCOPE(*JOB)   
  OVRDBF     FILE(QSHSTDOUT) TOFILE(QTEMP/QSHSTDOUT) OVRSCOPE(*JOB)
/* PCI I/O processor - slot C03 / DRC index 21030021 */            
  CHGVAR     VAR(&QSHCMD) VALUE('ssh hmc -T lshwres -r io +        
               --rsubtype slot -m +                                
               Server-9406-550-SNxxxxxxx -F lpar_name  +           
               --filter slots=21030021')                           
  QSH        CMD(&QSHCMD)                                          
  MONMSG     MSGID(CPF0000)                                        
  RCVF       RCDFMT(QSHSTDOUT)                                     
  MONMSG     MSGID(CPF0000)                                        
     IF         COND(&QSHSTDOUT = 'null') THEN(DO)                        
    CHGVAR     VAR(&SYSTEM03) VALUE('          ')                      
    CHGVAR     VAR(&MSGDTA) VALUE(&MSGDTA *BCAT 'Slot C03 +            
                 not assigned.')                                       
  ENDDO                                                                
  ELSE       CMD(DO)                                                   
    CHGVAR VAR(&SYSTEM03) VALUE(&QSHSTDOUT)                            
    CHGVAR     VAR(&MSGDTA) VALUE('Slot C03 +                          
                 assigned to system' *BCAT &SYSTEM03 *TCAT '.')        
  ENDDO                                                                
  DLTOVR     FILE(STDOUT) LVL(*JOB)                                    
  OVRDBF     FILE(STDOUT) TOFILE(QTEMP/QSHSTDOUT2) OVRSCOPE(*JOB)      
/* PCI Fibre Channel Tape Controller - slot C04 / DRC index 21040021 */
  CHGVAR     VAR(&QSHCMD) VALUE('ssh hmc -T lshwres -r io +            
               --rsubtype slot -m +                                    
               Server-9406-550-SNxxxxxxx -F lpar_name  +               
               --filter slots=21040021')                               
  QSH        CMD(&QSHCMD)                                              
  MONMSG     MSGID(CPF0000)                                            
  CPYF       FROMFILE(QTEMP/QSHSTDOUT2) +                              
                   TOFILE(QTEMP/QSHSTDOUT) MBROPT(*ADD) +            
               FMTOPT(*NOCHK)                                    
  RCVF       RCDFMT(QSHSTDOUT)                                   
  MONMSG     MSGID(CPF0000)                                      
  IF         COND(&QSHSTDOUT = 'null') THEN(DO)                  
    CHGVAR     VAR(&SYSTEM04) VALUE('          ')                
    CHGVAR     VAR(&MSGDTA) VALUE(&MSGDTA *BCAT 'Slot C04 +      
                 not assigned.')                                 
    SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +    
                 MSGTYPE(*COMP)                                  
  ENDDO                                                          
  ELSE       CMD(DO)                                             
    CHGVAR VAR(&SYSTEM04) VALUE(&QSHSTDOUT)                      
    CHGVAR     VAR(&MSGDTA) VALUE(&MSGDTA *BCAT 'Slot C04 +      
                 assigned to system' *BCAT &SYSTEM04 *TCAT '.')  
    SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +    
                 MSGTYPE(*COMP)                                  
  ENDDO                                                          
  DLTOVR     FILE(STDOUT QSHSTDOUT) LVL(*JOB)                    
ENDPGM:                                                          
  RETURN 
ENDPGM                  
Topic revision: r2 - 01 Oct 2014 - 19:37:02 - UnknownUser
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback