TechTalk: SAVNONSYS Command

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

I have heard a lot of complaints about the SAVLIB *NONSYS command. This command requires a dedicated system and backs up many unnecessary libraries. I use my SAVNONSYS program (1) to back up all libraries that do not start with # or Q (plus the QS36F library). This program also keeps track of the last library backed up. If more than one tape is required to perform the backup, the program will use the reply list to abort the backup. When the backup is restarted it will continue with the next library to be saved.

I have heard a lot of complaints about the SAVLIB *NONSYS command. This command requires a dedicated system and backs up many unnecessary libraries. I use my SAVNONSYS program (Figure 1) to back up all libraries that do not start with # or Q (plus the QS36F library). This program also keeps track of the last library backed up. If more than one tape is required to perform the backup, the program will use the reply list to abort the backup. When the backup is restarted it will continue with the next library to be saved.

SAVNONSYS is called with one parameter containing the backup device (only tape devices are supported). The ADDRPYLE command is used to add 'C'ancel reply for message CPA4088 (load next tape on device). This is done in order to end the job when the end of tape is reached. The next statement checks to see if the SAVNONSYS data area exists. I use the MONMSG command to condition the creation of the data area. The CHGJOB command is used to change the log option to display first level messages and to specify that pre-defined messages are answered using the system reply list. (The first level message logging will produce a log of all the libraries that were saved and the number of objects saved from each library). The message queue is changed to *NOTIFY in order to prevent messages from suspending the job. (If your message queue is in *BREAK mode and a message arrives, the interactive job will be suspended until you get out of the message queue display).

The display object description command is used to create a list of all the libraries on the system. The list is directed to file ##LIBS in QTEMP. The last saved library name is retrieved from the data area into variable &STRTLIB, if the last library saved was QS36F, &STRTLIB is cleared.

The main processing loop will bypass any library starting with "#" or "Q" and any library that is less than the last library saved. Before each save attempt, the pre-check value is retrieved from the data area. If pre-check is *YES, all objects in the library must be available for a successful save. If the value is *NO, the save will bypass locked objects. Message CPF3771 is considered a successful save. All other CPF3700 messages will result in a message to QSYSOPR and a 60 second delay before the save operation will be retried. At the end of each save, the data area is updated with the name of the library. When the end of file is reached, the QS36F library is saved. At the end of the program a job log is printed and the system reply list entry is removed.

Alon Fluxman Highlands Ranch, Colorado


TechTalk: SAVNONSYS Command

Figure 1 The SAVNONSYS program

 SAVNONSYS: + PGM PARM(&BACKUPDEV) DCL VAR(&BACKUPDEV) TYPE(*CHAR) LEN(10) DCL VAR(&PRECHK) TYPE(*CHAR) LEN(4) DCL VAR(&STRTLIB) TYPE(*CHAR) LEN(10) DCLF FILE(QADSPOBJ) ADDRPYLE SEQNBR(101) MSGID(CPA4088) RPY('C') MONMSG MSGID(CPF2555) EXEC(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Reply id 101 + already on system reply list ') MSGTYPE(*ESCAPE) ENDDO CHKOBJ OBJ(SAVNONSYS) OBJTYPE(*DTAARA) MONMSG MSGID(CPF9800) EXEC(DO) CRTDTAARA DTAARA(QGPL/SAVNONSYS) TYPE(*CHAR) LEN(20) VALUE(' - *YES') ENDDO CHGJOB LOG(*SAME *SAME *MSG) INQMSGRPY(*SYSRPYL) CHGMSGQ MSGQ(QSYSOPR) DLVRY(*NOTIFY) MONMSG MSGID(CPF2451) INZTAP DEV(&BACKUPDEV) NEWVOL(NONSYS) CHECK(*NO) MONMSG MSGID(CPF6760) EXEC(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('NONSAVSYS + backup ended abnormally .. Missing tape') MSGTYPE(*ESCAPE) ENDDO DSPOBJD OBJ(QSYS/*ALL) OBJTYPE(*LIB) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/##LIBS) RTVDTAARA DTAARA(SAVNONSYS (1 10)) RTNVAR(&STRTLIB) IF COND(&STRTLIB *EQ 'QS36F') THEN(CHGVAR VAR(&STRTLIB) VALUE(' - ')) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/##LIBS) READ: + RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(SAVEQS36)) IF COND(%SST(&ODOBNM 1 1) *EQ '#' *OR %SST(&ODOBNM 1 1) *EQ 'Q') + THEN(GOTO CMDLBL(READ)) IF COND(&ODOBNM *LE &STRTLIB) THEN(GOTO CMDLBL(READ)) SAVE: + RTVDTAARA DTAARA(SAVNONSYS (11 4)) RTNVAR(&PRECHK) IF COND(&PRECHK *NE '*NO ') THEN(CHGVAR VAR(&PRECHK) VALUE('*YES')) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Backup started + for library ' *CAT &ODOBNM) TOPGMQ(*EXT) MSGTYPE(*STATUS) SAVLIB LIB(&ODOBNM) DEV(&BACKUPDEV) ENDOPT(*LEAVE) CLEAR(*ALL) + PRECHK(&PRECHK) DTACPR(*YES) MONMSG MSGID(CPF4901 CPF3742 CPF5104 CPF3794) EXEC(GOTO + CMDLBL(ENDPGM)) MONMSG MSGID(CPG3771) EXEC(GOTO CMDLBL(CHGDTA)) MONMSG MSGID(CPF3700) EXEC(DO) SNDUSRMSG MSG('Library ' *CAT *ODOBNM *CAT ' cannot be saved + now. The program will try again in 60 seconds') + MSGTYPE(*INFO) TOMSGQ(*SYSOPR) DLYJOB DLY(60) GOTO CMDLBL(SAVE) ENDDO CHGDTA: + CHGDTAARA DTAARA(SAVNONSYS (1 10)) VALUE(&ODOBNM) GOTO CMDLBL(READ) SAVEQS36: + SAVLIB LIB(QS36F) DEV(&BACKUPDEV) ENDOPT(*LEAVE) CLEAR(*ALL) + PRECHK(*YES) DTACPR(*YES) MONMSG MSGID(CPF3700) EXEC(DO) SNDUSRMSG MSG('Library QS36F cannot be saved now. The program + will try again in 60 seconds') MSGTYPE(*INFO) TOMSGQ(*SYSOPR) DLYJOB DLY(60) GOTO CMDLBL(SAVEQS36) ENDDO CHGDTAARA DTAARA(SAVNONSYS (1 10)) VALUE(QS36F) ENDPGM: + DSPJOBLOG JOB(*) OUTPUT(*PRINT) RMVRPYLE SEQNBR(101) ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: