02
Sat, Nov
2 New Articles

Free Up Disk Space by Removing Program Observabili

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

Save disk space with confidence! Selectively remove program observability by days.

While we all start off with more disk space than we could ever imagine maxing out, it's amazing how quickly that large amount of space becomes not so large. Removing ob-servability from programs can help you to keep your disk space in tow by eliminating statement number and field cross-reference information from those programs where it's not needed.

Generally, program observability is removed using the Change Program (CHGPGM) command, specifying *ALL for the RMVOBS parameter:

CHGPGM PGM(PGM1) RMVOBS(*ALL)

Removing observability on my system reduced program sizes by impressive amounts; a summary of the space reductions for some of my programs appears in 1.

Removing observability on my system reduced program sizes by impressive amounts; a summary of the space reductions for some of my programs appears in Figure 1.

Though the savings are substantial and may tempt you to go overboard, wide- scale purging of observability quite often results in inconvenience. For instance, interactive debug and trace facilities, as well as system messaging functions, rely on the statement and field information contained in the observability area. Therefore, when observability is removed from a program, debugging commands like Start Debug (STR-DBG) no longer work for that program. Also, if an execution-time error occurs, the error message will not contain the statement number at which the error occurred. And once removed in the traditional manner, observability can be replaced only through the hassle of recompiling the program from source or, in the case of DFU, recreating the program using the command STRDFU OPTION(3).

Considering the loss of debugging facilities and error message information, only programs without bugs should have their observability removed. The best angle of attack should enable the programmer to save storage and feel confident that programs will not fail. That is where the Remove Program Observability (RMVPGMOBS) utility command comes in.

The Program

With the help of a short CL program, observability can selectively be removed from programs based on the date the program was created. The theory here is that if a program was created and placed in production, say, over 60 days ago, it is probably functioning well without problems.

If the program had bugs, we assume someone has performed the necessary maintenance and recompiled the program within the last couple of months. Therefore, if the program is more than 60 days old, we want to remove its observability area to save space.

The CL program uses the Display Object Description (DSPOBJD) command to create a list of programs and QUSRTOOL utility CHKDAT to check the program's creation date. (See "From the Toolbox" in this issue for more information on installing a QUSRTOOL tool.) These two elements work together to accomplish the task of selectively removing observability from programs in production.

First, the RMVPGMOBS command is used to prompt for the necessary parameters. (See 2.) These parameters are fed into command processing program PGM- 004CL, shown in 3.

First, the RMVPGMOBS command is used to prompt for the necessary parameters. (See Figure 2.) These parameters are fed into command processing program PGM- 004CL, shown in Figure 3.

The DSPOBJD command creates an output file of programs, based on the user's selection of program and library names.

The CL program reads the file and, program by program, attempts to remove observability only from those programs that are older than the number of days specified in the &DAYSOLD parameter.

CHKDAT uses the &DAYSOLD parameter to determine if the creation date of the program (&ODCDAT) is within this period of time or not. If not, CHKDAT issues a CPF9898 escape message which is monitored using the Monitor Message (MONMSG) command.

Last but not least, the CHGPGM command is used to actually remove observability from the program. The CHGPGM command is the key to this program. However, it can fail if:

1. Observability has already been removed from the program.

2. The user executing RMVPGMOBS, either directly or through adopted authority, does not have *CHANGE authority to the program and/or at least *USE rights to the library which contains the program.

3. The specified program is in QSYS or QGDDM library.

The CL program PGM004CL attempts to avoid or trap for these possible error conditions through use of MONMSG and the Receive Message (RCVMSG) command. The program sends *DIAG messages as each error is encountered. These stack up on the *PRV (calling program's) message queue and can be seen at the bottom of the screen. Of course, if there is more than one message, you can position the cursor on the message and press the Page Down key to see more. Other potential error conditions are trapped using the global message monitor MONMSG CPF0000.

Because authority errors may prevent this program from functioning to its fullest, it is suggested that the PGM004CL program be compiled with USRPRF(*OWNER), while signed on as QSECOFR or another user profile with *ALLOBJ special authority.

Flexible Enough to Suit Your Needs

If you do not want to be very selective, you can specify zero days old for the DAYSOLD parameter. This will remove observability from all programs older than the current date. In this case, you might as well use CHGPGM directly since it will accept *ALL as the program name.

CHGPGM can be run over only one library, or just the user portion of the library list (*USRLIBL). RMVPGMOBS, on the other hand, allows you to specify *ALLUSR for the library portion of the qualified program name. This lets you selectively remove observability from programs in all the user libraries on your system. Wow!

You cannot specify the job library list (*LIBL) for the library parameter. This is because programs in the system portion of *LIBL would not be eligible for change.

And there you have it: a utility that helps save disk space, but that also logically tries to preserve AS/400 debugging facilities when they might be needed. You'll feel confident that all the kinks have been worked out of the program objects you've tagged as candidates for your space reduction efforts.


Free Up Disk Space by Removing Program Observabili

Figure 1 Program sizes before/after removing observability

 Figure 1: Program Sizes Before and After Removing Observability Size Size Space Percent Program Before After Saved Saved IV520C2 10,240 5,120 5,120 50.00 UD035R1 49,152 15,360 33,792 68.75 UD055R 100,864 29,148 71,716 71.10 AR101R 179,712 53,760 125,952 70.09 AR104R 219,648 69,120 150,528 68.53 
Free Up Disk Space by Removing Program Observabili

Figure 2 Command RMVPGMOBS

 RMVPGMOBS: CMD PROMPT('Remove Program Observability') PARM KWD(PGM) TYPE(QUAL1) MIN(1) PROMPT('Program') PARM KWD(DAYS) TYPE(*DEC) LEN(3) DFT(60) RANGE(0 + 999) PROMPT('Number of days old') QUAL1: QUAL TYPE(*GENERIC) LEN(10) SPCVAL((*ALL)) + EXPR(*YES) QUAL TYPE(*NAME) LEN(10) DFT(*USRLIBL) + SPCVAL((*CURLIB) (*USRLIBL) (*ALLUSR)) + EXPR(*YES) PROMPT('Library') 
Free Up Disk Space by Removing Program Observabili

Figure 3 CL program PGM004CL

 PGM004CL: + PGM PARM(&PGMLIB &DAYSOLD) DCLF FILE(QADSPOBJ) DCL VAR(&DAYSOLD) TYPE(*DEC) LEN(3 0) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(80) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&PGM) TYPE(*CHAR) LEN(10) DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(20) /* Global error trap */ MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(DIAGMSG)) /* Break qualified name of program */ CHGVAR VAR(&PGM) VALUE(%SST(&PGMLIB 1 10)) CHGVAR VAR(&LIB) VALUE(%SST(&PGMLIB 11 10)) /* Programs in QSYS OR QGDDM cannot be changed */ IF COND(&LIB *EQ 'QSYS' *OR &LIB *EQ 'QGDDM') THEN(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Programs in + system library' *BCAT &LIB *BCAT 'cannot be changed') + MSGTYPE(*ESCAPE) RETURN ENDDO /* Turn &DAYSOLD into a negative number */ CHGVAR VAR(&DAYSOLD) VALUE(&DAYSOLD * -1) /* Produce outfile listing all programs requested */ DSPOBJD OBJ(&LIB/&PGM) OBJTYPE(*PGM) DETAIL(*SERVICE) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ) /* For each program... */ READFILE: + RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF)) /* Use CHKDAT to chedk date of creation (&ODCDAT). If &ODCDAT + is older than &DAYSOLD, remove program observability */ TAATOOL/CHKDAT DATE(&ODCDAT) DAYLORNG(&DAYSOLD) DAYHIRNG(0) MONMSG MSGID(CPF9898) EXEC(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Now removing + observability from' *BCAT &ODOBNM) TOPGMQ(*EXT) + MSGTYPE(*STATUS) CHGPGM PGM(&ODLBNM/&ODOBNM) RMVOBS(*ALL) MONMSG MSGID(CPF9821 CPF0547) /* CPF9821: Not authorized. + CPF0547: Cannot remove observability */ RCVMSG MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID) + MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) MONMSG MSGID(CPF0000) RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID) + MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) MONMSG MSGID(CPF0000) ENDDO GOTO CMDLBL(READFILE) /* End program when all programs are processed */ EOF: + DLTOVR FILE(QADSPOBJ) MONMSG MSGID(CPF0000) RETURN /* Resend all *DIAG messages */ DIAGMSG: + RCVMSG MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + SNDMSGFLIB(&MSGFLIB) IF COND(&MSGID *NE ' ') THEN(DO) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*DIAG) GOTO CMDLBL(DIAGMSG) ENDDO /* Resend exception message */ RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + SNDMSGFLIB(&MSGFLIB) IF COND(&MSGID *NE ' ') THEN(DO) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) ENDDO ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • 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.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • 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

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • 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: