One Way To Condense A Verbose Spooled File
November 29, 2016 Ted Holt
IBM i includes many reports that we can use to glean a lot of information. If you run packaged software, the vendor likely includes many other reports. The problem with such reports is that they often contain more information than what you need and want. After all, they’re written for the world at large, not tailored for you. It may be that a utility that resides on your system can transform reports into something more suitable for you and those who use your system. First, let’s get a report. DSPLNK OUTPUT(*PRINT) DETAIL(*EXTENDED) DSPOPT(*USER) Running this command on one of the systems I use produced a 52-page report. Display Attributes Page 2 5770SS1 V7R1M0 100423 SYSTEMX 11/30/16 12:00:00 EST Object . . . . . . : /home/tholt/archive.tar Type . . . . . . . . . . . . . . . . . : STMF File ID . . . . . . . . . . . . . . . : X'00000000000000019748873800074532' Owner . . . . . . . . . . . . . . . . : THOLT System object is on . . . . . . . . . : Local Auxiliary storage pool . . . . . . . . : 1 Object overflowed . . . . . . . . . : No Coded character set ID . . . . . . . . : 819 Hidden file . . . . . . . . . . . . . : No PC system file . . . . . . . . . . . . : No Read only . . . . . . . . . . . . . . : No Need to archive (PC) . . . . . . . . . : Yes Need to archive (System) . . . . . . . : Yes Creation date/time . . . . . . . . . . : 11/01/15 18:39:29 Last access date/time . . . . . . . . : 11/01/15 18:40:01 Data change date/time . . . . . . . . : 11/01/15 18:40:01 Attribute change date/time . . . . . . : 11/01/15 18:40:01 Size of object in bytes . . . . . . . : 40960 Allocated size of object . . . . . . . : 65536 File format . . . . . . . . . . . . . : *TYPE2 Size of extended attributes . . . . . : 0 Storage freed . . . . . . . . . . . . : No Temporary object . . . . . . . . . . . : No Disk storage option . . . . . . . . . : *NORMAL Main storage option . . . . . . . . . : *NORMAL Auditing value . . . . . . . . . . . . : *NONE Object domain . . . . . . . . . . . . : *SYSTEM Number of hard links . . . . . . . . . : 1 Set effective user ID . . . . . . . . : No Set effective group ID . . . . . . . . : No Restricted rename and unlink . . . . . : No Last used date . . . . . . . . . . . . : 11/01/15 Days used count . . . . . . . . . . . : 1 Reset date . . . . . . . . . . . . . : Allow write during save . . . . . . . : No Can be saved . . . . . . . . . . . . . : Yes Digitally signed . . . . . . . . . . . : No Object is currently journaled . . . . : No Object scanning . . . . . . . . . . . : *YES Scan status . . . . . . . . . . . . : *REQUIRED Display Attributes Page 3 5770SS1 V7R1M0 100423 IUSR011 11/28/16 01:00:49 EST System use . . . . . . . . . . . . . . : *NONE Display Hard Links Page 4 5770SS1 V7R1M0 100423 IUSR011 11/28/16 01:00:49 EST If I only want the object names, complete with path, I use this command within Qshell to reduce the report: system 'DSPLNK OUTPUT(*PRINT) DETAIL(*EXTENDED) DSPOPT(*USER)' | sed -n '/Object . ./p' | rfile -wQ qsysprt The system utility executes the DSPLNK command and sends the report to the standard output file, which is piped into sed, the stream editor. Sed selects the lines that contain the string “Object . .” and writes them to standard out, which is piped into the Rfile utility to produce a spooled file. The -n switch tells sed not to write to standard output automatically. The p subcommand at the end of the pattern tells sed to print lines that match the pattern. My report has shrunk to a single page! Object . . . . . . . : * Object . . . . . . : /home/tholt/archive.tar Object . . . . . . : /home/tholt/archive.tar Object . . . . . . : /home/tholt/custcdt1.txt Object . . . . . . : /home/tholt/custcdt1.txt Object . . . . . . : /home/tholt/custcdt2.txt Object . . . . . . : /home/tholt/custcdt2.txt Object . . . . . . : /home/tholt/custcdt3.txt Object . . . . . . : /home/tholt/custcdt3.txt Object . . . . . . : /home/tholt/customer-data.csv Object . . . . . . : /home/tholt/customer-data.csv Object . . . . . . : /home/tholt/customer-data.txt Object . . . . . . : /home/tholt/customer-data.txt Object . . . . . . : /home/tholt/data.csv Object . . . . . . : /home/tholt/data.csv Object . . . . . . : /home/tholt/data-script.txt Object . . . . . . : /home/tholt/data-script.txt Object . . . . . . : /home/tholt/data2.csv Object . . . . . . : /home/tholt/data2.csv Object . . . . . . : /home/tholt/pay-work.csv Object . . . . . . : /home/tholt/pay-work.csv Object . . . . . . : /home/tholt/pay-work-script.txt Object . . . . . . : /home/tholt/pay-work-script.txt Object . . . . . . : /home/tholt/src.tar Object . . . . . . : /home/tholt/src.tar Object . . . . . . : /home/tholt/yycomp Object . . . . . . : /home/tholt/yycomp Object . . . . . . : /home/tholt/AARDVARK.CSV Object . . . . . . : /home/tholt/AARDVARK.CSV Object . . . . . . : /home/tholt/AARDVARKTX.CSV Object . . . . . . : /home/tholt/AARDVARKTX.CSV Object . . . . . . : /home/tholt/CustCdt.coldef Object . . . . . . : /home/tholt/CustCdt.coldef Object . . . . . . : /home/tholt/CustCdt.csv Object . . . . . . : /home/tholt/CustCdt.csv Maybe I want a little more information, such as the creation date. Sed can handle that. system 'DSPLNK OUTPUT(*PRINT) DETAIL(*EXTENDED) DSPOPT(*USER)' | sed -n -e '/Object . ./p' -e '/Creation date/time/p' | rfile -wQ qsysprt As before, the system utility runs the DSPLNK command and sends the report to sed. Since I want sed to look for two patterns, I must prefix each one with the -e switch. The report is longer, but still a single page. Here’s part of it. Object . . . . . . . : * Object . . . . . . : /home/tholt/archive.tar Creation date/time . . . . . . . . . . : 11/01/15 18:39:29 Object . . . . . . : /home/tholt/archive.tar Object . . . . . . : /home/tholt/custcdt1.txt Creation date/time . . . . . . . . . . : 10/13/15 20:30:31 Object . . . . . . : /home/tholt/custcdt1.txt Object . . . . . . : /home/tholt/custcdt2.txt Creation date/time . . . . . . . . . . : 10/13/15 19:54:52 Object . . . . . . : /home/tholt/custcdt2.txt Object . . . . . . : /home/tholt/custcdt3.txt Creation date/time . . . . . . . . . . : 10/13/15 20:28:42 Object . . . . . . : /home/tholt/custcdt3.txt Object . . . . . . : /home/tholt/customer-data.csv Creation date/time . . . . . . . . . . : 11/01/15 18:27:23 Object . . . . . . : /home/tholt/customer-data.csv Object . . . . . . : /home/tholt/customer-data.txt Creation date/time . . . . . . . . . . : 10/13/15 23:15:13 Object . . . . . . : /home/tholt/customer-data.txt It isn’t a beautiful report, but I can read it, and that’s all that matters to most users. I’d rather look at a short, ugly report with exactly what I need than a long, beautiful one with unnecessary information any day.
|