We help IT Professionals succeed at work.

Program to initialize more than one tapes on as400

Low Priority
232 Views
Last Modified: 2018-06-25
Hi, we have two tapes to be used for daily backup. and we have scheduled jobs to run the daily backups at night. previously, we only need 1 tape but now, it asks for 2nd tape. we have a program to initialize single tape, but not for 2 tapes. can anyone helps on how to intialize more than 1 tape  for daily backup   (1 week rotation basis). 2 tape cartridges per day, 14 tapes/week. os version: v6r1. thanks.
      PGM                                                                
      DCL VAR(&DAY) TYPE(*CHAR) LEN(4)                                  
      DCL VAR(&DLYVOL) TYPE(*CHAR) LEN(6)                                
      RTVSYSVAL SYSVAL(QDAYOFWEEK) RTNVAR(&DAY)                          
      CHGVAR VAR(&DLYVOL) VALUE('DLY' *CAT %SST(&DAY 2 3))              
      INZTAP DEV(tapxx) NEWVOL(&DLYVOL) NEWOWNID(xxxx) CHECK(*NO) -
 ENDOPT(*REWIND)                                                        
      ENDPGM
Comment
Watch Question

Gary PattersonVP Technology / Senior Consultant
CERTIFIED EXPERT

Commented:
Untested.  You'll probably need to do a little work.

PGM                                                                
      DCL VAR(&DAY) TYPE(*CHAR) LEN(4)                                  
      DCL VAR(&DLYVOL) TYPE(*CHAR) LEN(6)
      DCL        &MSGKEY *CHAR LEN(4)
      DCL        &MSGRPY *CHAR LEN(1)                                
      RTVSYSVAL SYSVAL(QDAYOFWEEK) RTNVAR(&DAY) 

      /* Initialize second tape first, then eject it */                   
      CHGVAR VAR(&DLYVOL) VALUE('DLY' *CAT %SST(&DAY 2 3) *CAT 'B')              
      INZTAP DEV(tapxx) NEWVOL(&DLYVOL) NEWOWNID(xxxx) CHECK(*NO) ENDOPT(*UNLOAD)

       /* Send message every 5 min to QSYSOPR until Y response is received. */
       DOUNTIL (&MSGRPY *EQ 'Y') *OR (&MSGRPY *EQ 'y')) 
      
         SNDPGMMSG  MSG('Tape B initialized.  +
                                 Load tape A and reply (Y).') +
                                 TOMSGQ(QSYSOPR) +
                                 MSGTYPE(*INQ) KEYVAR(&MSGKEY)
         RCVMSG     MSGTYPE(*RPY) MSGKEY(&MSGKEY) WAIT(600) MSG(&MSGRPY)

       ENDDO

      /* Initialize first tape last, and just rewind it and leave it in place for backup */
      CHGVAR VAR(&DLYVOL) VALUE('DLY' *CAT %SST(&DAY 2 3) *CAT 'A')              
      INZTAP DEV(tapxx) NEWVOL(&DLYVOL) NEWOWNID(xxxx) CHECK(*NO) ENDOPT(*REWIND)                                                        
                                                        
      ENDPGM 

Open in new window

Author

Commented:
Hi Gary, i have tried the program, it returned error at this line:

 DOUNTIL (&MSGRPY *EQ 'Y') *OR (&MSGRPY *EQ 'Y'))       --A matching parenthesis not found. tried to remove the last parenthesis, not didnt work. :(          

and, we are going to use barcode for this BACKUP,Thus  i have changed the newownid to (&ctgid) will it be able to trace or i need to declare it?how?
      /* INITIALIZE SECOND TAPE FIRST, THEN EJECT IT */                            
            CHGVAR VAR(&DLYVOL) VALUE('DLY' *CAT %SST(&DAY 2 3) *CAT 'B')          
 INZTAP DEV(TAPMLB01) NEWVOL(&DLYVOL) NEWOWNID(&CTGID) CHECK(*NO) ENDOPT(*UNLOAD)  

Appreciate your help. sorry i m not good in CL Programming. thanks for your help.
Gary PattersonVP Technology / Senior Consultant
CERTIFIED EXPERT

Commented:
Need to add a left paren:

DOUNTIL ((&MSGRPY *EQ 'Y') *OR (&MSGRPY *EQ 'Y'))  

I don't understand your barcode comment.  Are you using BRMS and a tape library or some sort, or just a single tape drive?

Author

Commented:
Ok- did it.  when i issued the command, i receive a msg at dspmsg qsysopr to reply Y. We do not have any system operator to reply, it has to be automated. For your information,  we have loaded 14 tapes for 1 week backup.  2 tapes per day.

About the barcode comment, previously we used LTO4, so we do not use barcode. but, for this new machine, we are going to use the barcode to identify the backup is done on the specific tape. and at the same time, daily backup takes 2 tapes per day (as the library growth).
Gary PattersonVP Technology / Senior Consultant
CERTIFIED EXPERT

Commented:
Hi Noraz,

Sounds like you want me to develop an entire application for you.  I can't do that here.  I'd need access to.your system and tape drive to develop and test, and a much clearer understanding of what you are trying to do.  I am happy to help you here if you try to write this and have a specific problem.

Author

Commented:
Hi Gary, Exactly. as i mentioned earlier, I m too green in CL Programming. But, really appreciate your help. I have responded to your PM. Thank you very much.