I have a backup job which fails to back up the first 4 objects and I believe it's down to my programmer bad programming. This program:-
2100 PGM PARM(&LEDGER) 2200 DCL VAR(&LEDGER) TYPE(*CHAR) LEN(2) 2300 DCL VAR(&OBJLIB) TYPE(*CHAR) LEN(10) 2400 DCL VAR(&SECULIB) TYPE(*CHAR) LEN(10) 2500 DCL VAR(&JRNLIB) TYPE(*CHAR) LEN(10) 2600 DCL VAR(&LYRLIB) TYPE(*CHAR) LEN(10) 16/01/08 2700 DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10) 16/01/08 2800 MONMSG MSGID(CPF0000) 2900 CHGVAR VAR(&OBJLIB) VALUE(&LEDGER *TCAT 'OBJ') 3000 CHGVAR VAR(&SECULIB) VALUE(&LEDGER *TCAT 'SECU') 3100 CHGVAR VAR(&JRNLIB) VALUE(&LEDGER *TCAT 'JRN') 3200 CHGVAR VAR(&LYRLIB) VALUE(&LEDGER *TCAT 'LYR') 16/01/08 3300 CHGVAR VAR(&PGMLIB) VALUE(&LEDGER *TCAT 'PGM') 16/01/08 3400 MONMSG MSGID(CPF1002) EXEC(GOTO CMDLBL(END)) 3500 SAVLIB LIB(&OBJLIB) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) 22/03/06 3600 SAVLIB LIB(&SECULIB) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) 22/03/06 3700 SAVLIB LIB(&JRNLIB) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) 22/03/06 3800 SAVLIB LIB(&LYRLIB) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) 16/01/08 3900 SAVLIB LIB(&PGMLIB) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) 16/01/08 4000 MONMSG MSGID(CPF387A CPF0000) 4100 CHGJRN JRN(&JRNLIB/&JRNLIB) JRNRCV(*GEN) 4200 END: + 4300 ENDPGM
I dont see anything in here that indicates to me that checks to see if the tape drive is available before it starts and also it seems to me that if it does get hold of the tape drive, it will be in use when the seconf save attempts to run and then the program will end do to the END tag
The errors I see in the job log give me this information:-
*NONE Command 28/10/11 04:30:12.620040 QCADRV QSYS 0393 DAILYCK01 NKHLIB 0011 Message . . . . : 2400 - DLYJOB DLY(0300) *NONE Command 28/10/11 04:35:12.696112 QCLCLCPR QSYS 045C DAILYCK01 NKHLIB 0015 Message . . . . : 2500 - CALL PGM(NKHLIB/SAVLIB_ALL) /* The CALL command contains parameters */ *NONE Command 28/10/11 04:35:12.696344 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 0035 Message . . . . : 3500 - SAVLIB LIB(CKOBJ) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) CPF5729 Escape 40 28/10/11 04:37:12.776232 QSRLIBS1 QSYS *STMT SAVLIB_ALL NKHLIB 0035 From module . . . . . . . . : QSRS1MED From procedure . . . . . . : qsrSendMediaMessages Statement . . . . . . . . . : 36 Message . . . . : Not able to allocate object TAP01. Cause . . . . . : Object TAP01 is being used by another job. If the object is a device, then the device is not varied on or is in use by another job.
MSGID TYPE SEV DATE TIME FROM PGM LIBRARY INST TO PGM LIBRARY INST Recovery . . . : Use the WRKOBJLCK command to determine what job has a lock on the object. Use the VRYCFG command to vary the configuration on if necessary. When the object is available, try the request again. *NONE Command 28/10/11 04:37:12.835656 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 003D Message . . . . : 3600 - SAVLIB LIB(CKSECU) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) CPF5729 Escape 40 28/10/11 04:39:12.875368 QSRLIBS1 QSYS *STMT SAVLIB_ALL NKHLIB 003D From module . . . . . . . . : QSRS1MED From procedure . . . . . . : qsrSendMediaMessages Statement . . . . . . . . . : 36 Message . . . . : Not able to allocate object TAP01. Cause . . . . . : Object TAP01 is being used by another job. If the object is a device, then the device is not varied on or is in use by another job. Recovery . . . : Use the WRKOBJLCK command to determine what job has a lock on the object. Use the VRYCFG command to vary the configuration on if necessary. When the object is available, try the request again. *NONE Command 28/10/11 04:39:12.884376 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 0045 Message . . . . : 3700 - SAVLIB LIB(CKJRN) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) CPF5729 Escape 40 28/10/11 04:41:13.245024 QSRLIBS1 QSYS *STMT SAVLIB_ALL NKHLIB 0045 From module . . . . . . . . : QSRS1MED From procedure . . . . . . : qsrSendMediaMessages Statement . . . . . . . . . : 36 Message . . . . : Not able to allocate object TAP01. Cause . . . . . : Object TAP01 is being used by another job. If the object is a device, then the device is not varied on or is in use by another job. Recovery . . . : Use the WRKOBJLCK command to determine what job has a lock on the object. Use the VRYCFG command to vary the configuration on if necessary. When the object is available, try the request again. *NONE Command 28/10/11 04:41:13.290488 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 004D Message . . . . : 3800 - SAVLIB LIB(CKLYR) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) CPF4024 Diagnostic 10 28/10/11 04:42:42.306928 QTAERR QSYS 00E6 QSRLIBS2 QSYS *STMT To module . . . . . . . . . : QSRS2DAT To procedure . . . . . . . : qsrDM_Open Statement . . . . . . . . . : 28 Message . . . . : Volume THU on device TAP01 is density *ULTRIUM2. Cause . . . . . : The output volume is a different density than specified for file QSYSTAP in QSYS. Either the existing data files, or the labels on the volume may determine the volume density, or the tape device may not be able to process requested density. The density of the tape volume is used instead of the density in the tape device file. Recovery . . . : If the labeled tape density is not acceptable, prepare the tape with the correct density (INZTAP command), and then try the request again. CPI3203 Information 00 28/10/11 04:42:52.039144 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 1 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter specified, and 1 logical access paths are stored on the media with file A004P01_ in library CKLYR. CPI3203 Information 00 28/10/11 04:42:52.039240 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 1 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter
MSGID TYPE SEV DATE TIME FROM PGM LIBRARY INST TO PGM LIBRARY INST specified, and 1 logical access paths are stored on the media with file D001P01_ in library CKLYR. CPI3203 Information 00 28/10/11 04:42:52.039296 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 1 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter specified, and 1 logical access paths are stored on the media with file D001P01 in library CKLYR. CPI3203 Information 00 28/10/11 04:42:52.039360 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 1 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter specified, and 1 logical access paths are stored on the media with file D007P01_ in library CKLYR. CPI3203 Information 00 28/10/11 04:42:52.039456 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 2 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter specified, and 2 logical access paths are stored on the media with file G001P01 in library CKLYR. CPI3203 Information 00 28/10/11 04:42:52.039504 QDBSVPST QSYS 0144 QDBSVPST QSYS 0144 Message . . . . : 2 logical access paths saved or restored. Cause . . . . . : A save operation was done with the ACCPTH(*YES) parameter specified, and 2 logical access paths are stored on the media with file G001P01_ in library CKLYR. CPC3701 Completion 00 28/10/11 04:42:52.041808 QSRSLCP2 QSYS 05E7 SAVLIB_ALL NKHLIB 004D Message . . . . : 61 objects saved from library CKLYR. Cause . . . . . : 61 objects were saved on volumes THU sequence number 5069 at 28/10/11 04:42:42. The save operation ended on volume THU. If UPDHST(*YES) was specified, the save/restore history was updated unless otherwise indicated by the previously listed messages. *NONE Command 28/10/11 04:42:52.204936 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 0056 Message . . . . : 3900 - SAVLIB LIB(CKPGM) DEV(TAP01) ENDOPT(*LEAVE) SAVACT(*LIB) CPF4024 Diagnostic 10 28/10/11 04:43:00.008712 QTAERR QSYS 00E6 QSRLIBS2 QSYS *STMT To module . . . . . . . . . : QSRS2DAT To procedure . . . . . . . : qsrDM_Open Statement . . . . . . . . . : 28 Message . . . . : Volume THU on device TAP01 is density *ULTRIUM2. Cause . . . . . : The output volume is a different density than specified for file QSYSTAP in QSYS. Either the existing data files, or the labels on the volume may determine the volume density, or the tape device may not be able to process requested density. The density of the tape volume is used instead of the density in the tape device file. Recovery . . . : If the labeled tape density is not acceptable, prepare the tape with the correct density (INZTAP command), and then try the request again. CPC3701 Completion 00 28/10/11 04:43:13.637256 QSRSLCP2 QSYS 05E7 SAVLIB_ALL NKHLIB 0056 Message . . . . : 170 objects saved from library CKPGM. Cause . . . . . : 170 objects were saved on volumes THU sequence number 5071 at 28/10/11 04:43:00. The save operation ended on volume THU. If UPDHST(*YES) was specified, the save/restore history was updated unless otherwise indicated by the previously listed messages. *NONE Command 28/10/11 04:43:13.662640 QCADRV QSYS 0393 SAVLIB_ALL NKHLIB 0061 Message . . . . : 4100 - CHGJRN JRN(CKJRN/CKJRN) JRNRCV(*GEN)
CPC7011 Completion 00 28/10/11 04:43:14.079440 QJOCHGJN QSYS 1189 SAVLIB_ALL NKHLIB 0061
MSGID TYPE SEV DATE TIME FROM PGM LIBRARY INST TO PGM LIBRARY INST Message . . . . : Journal receiver CKJRN47048 created in library CKJRN. Cause . . . . . : Either a CRTJRNRCV or CHGJRN command completed, or a restore journal operation resulted in the creation of a journal receiver. CPF7020 Information 00 28/10/11 04:43:14.079456 QJOCHGJN QSYS 1189 SAVLIB_ALL NKHLIB 0061 Message . . . . : Journal receivers CKJRN47047 and *N detached. Cause . . . . . : Journal receiver CKJRN47047 in library CKJRN and *N in library *N were detached from journal CKJRN in library CKJRN. The journal receivers were detached from journal CKJRN for one of the following reasons: - a user issued a Change Journal (CHGJRN) command to attach new journal receivers - a user issued a Delete Journal (DLTJRN) command - the system performed the change journal function for a journal that is defined as MNGRCV(*SYSTEM) If only one receiver was detached, *N in library *N will be the second receiver name. Technical description . . . . . . . . : If journal CKJRN in library CKJRN is a remote journal, and if the user issued the DLTJRN command, journal receiver CKJRN47047 in CKJRN will be considered a partial journal receiver and will have no detach time associated with it. CPF7019 Information 00 28/10/11 04:43:14.079472 QJOCHGJN QSYS 1189 SAVLIB_ALL NKHLIB 0061 Message . . . . : Sequence number not reset. First sequence number is 1026965618. Cause . . . . . : A journal receiver was attached to journal CKJRN in library CKJRN in Auxilary Storage Pool (ASP) group *N without resetting the sequence number. 1026965618 is the first sequence number in the attached receiver. Recovery . . . : If the first sequence number in the new journal receiver exceeds 2000000000, then request another Change Journal (CHGJRN) to change journal receiver, specifying SEQOPT(*RESET) to reset the sequence numbers in the new journal receiver. If the sequence number exceeds the largest sequence number, 2147483136, no more entries can be added to the journal until the journal receiver is changed and the sequence numbers reset. *NONE Command 28/10/11 04:43:14.087640 QCLRTNE QSYS 0058 SAVLIB_ALL NKHLIB 0074 Message . . . . : - RETURN /* RETURN due to end of CL program */
Is there a better way to write this CL program to wait for the tape drive to be available and not just go to the end when it's in use?
Software/Hardware used:
iSeries V5R3
ASKED:
October 28, 2011 4:19 PM
UPDATED:
March 17, 2012 7:08 AM
I’m guessing this will make sure tape is ready for the first save but won’t the second find the tape in use?
The code allocates the tape before the 1st save starts and then keeps it allocated until the last save is done.
One minor programming note — line 3400 was never going to do anything.
The MONMSG at 2800 occurs in the source before the executable statements. It becomes a ‘global MONMSG’ that will apply to every executable statement in the program.
The MONMSG at 3400 was down in the executable area, so it becomes associated with whatever executable command preceded it. In this case, that was a CHGVAR; and a CHGVAR shouldn’t ever run into a CPF1002 exception.
But note that CharlieBrowne’s code also uses MONMSG and checks for CPF1002. The extended help for the ALCOBJ command shows that CPF1002 is a potential exception from ALCOBJ.
Tom
OK so just so I have this right, with the additional loop in as described, the program will insure it have the tape drive and keep it until the program is finished. So when the first SAVLIB command is executed it will be able to access the tape drive and save the library. My question is, does the second SAVLIB wait until the first SAVLIB to complete before executing or does it try and allocate the tape drive while it is still in use with the first SAVLIB.
Sorry for needing an idiots guide but I just don’t know and apparently there are no stupid questions. I just need my backups working.
Guy
Sorry for needing an idiots guide but I just don’t know
Every one of us started at some point. Wait until you do something really dumb. You’ll know it when it happens, and you won’t be posting about it in an on-line forum. You’ll just let it fade quietly in your distant memories. (There is no point in asking how I know that.)
Until then, forums are where basic questions get answered.
Tom
To answer your 2nd question.
Since this is all in one CL program, the 2nd SAVLIB will not start to execute until the 1st one is completed. There is no need to do anything with allocation of the tape drive in between the two SAVLIB commands snce this job has it allocated until it finishes or does the DLCOBJ.