![]() |
|
| Dwight Beech | |
Here is a little utility to help in reviewing file sizes within your iSeries libraries. The utility is called CUCFILSIZ. It has three parameters, and they are as follows:
CALL CUCFILSIZ PARM('library ' 'op ' '9999999999999')
Library Name: Up to 10 characters in quotes, if left blank it will assume *ALL for all libraries.
Operation Code: *EQ, *GE, *LE
File Size: Up to a terabyte within quotes left-justified. i.e. ' 10000'.
The program CUCFILSIZ simply performs a DSPLIB to a print file and then copies it to a physical file called CUPFIL using CPYSPLF. A CPYF command is executed on CUPFIL to extract the records you have selected using one of the operation codes (*EQ, *LE, *GE) into the file CUPFILQ.
A simple data query then creates a spool file that reports on the parameters you set up within the call.
I find this much simpler to review than having to go through pages and pages of a spool file looking for certain file sizes. It is also much simpler and faster than using option F17 while working with libraries within PDM.
Below is the source code for CUCFILSIZ.
-----------------------------------
About the author: Dwight Beech is superintendent, application support, at Cameco Corp. in Saskatoon, Saskatchewan, Canada, where he manages the operation of the application support group supporting 35 business applications.
/********************************************************************/
/* */
/* CUCFILSIZ */
/* */
/********************************************************************/
/* */
/* */
/* */
/* REVISED DESCRIPTION */
/* ------- ----------- */
/* Dec. 23/02 DWIGHT BEECH */
/* */
/********************************************************************/
/* */
PGM PARM(&LIB &OP &SIZE)
DCL VAR(&JOB) TYPE(*CHAR) LEN(10)
DCL VAR(&USERJ) TYPE(*CHAR) LEN(10)
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SIZE) TYPE(*CHAR) LEN(13)
DCL VAR(&OP) TYPE(*CHAR) LEN(3)
DCL VAR(&NBR) TYPE(*CHAR) LEN(6)
/* */
/* CREATE SPOOL FILE */
/* */
IF COND(&LIB *EQ ' ') THEN(DO)
CHGVAR VAR(&LIB) VALUE('*ALL ')
ENDDO
DSPLIB LIB(&LIB) OUTPUT(*PRINT)
/* */
/* COPY RECORDS FROM SPOOLFILE AND THEN TO DROP REDUDANT FIELDS */
/* */
RTVJOBA JOB(&JOB) USER(&USERJ) NBR(&NBR)
CPYSPLF FILE(QPDSPLIB) TOFILE(QGPL/CUPFIL) +
JOB(&NBR/&USERJ/&JOB) SPLNBR(*LAST) +
MBROPT(*REPLACE) CTLCHAR(*NONE)
DLTSPLF FILE(QPDSPLIB) JOB(&NBR/&USERJ/&JOB) +
SPLNBR(*LAST)
IF COND(&OP *EQ '*EQ' *OR &OP *EQ '*eq') THEN(DO)
CPYF FROMFILE(QGPL/CUPFIL) +
TOFILE(QGPL/CUPFILQ) +
MBROPT(*REPLACE) INCREL((*IF FIL1 *EQ ' +
') (*AND FILNAM *NE 'Object ') (*AND +
FILTYP *NE ' Tota') (*AND FILTYP *NE +
' * * * ') (*AND FILSIZ *EQ &SIZE)) +
FMTOPT(*MAP *DROP)
ENDDO
IF COND(&OP *EQ '*LE' *OR &OP *EQ '*le') THEN(DO)
CPYF FROMFILE(QGPL/CUPFIL) +
TOFILE(QGPL/CUPFILQ) +
MBROPT(*REPLACE) INCREL((*IF FIL1 *EQ ' +
') (*AND FILNAM *NE 'Object ') (*AND +
FILTYP *NE ' Tota') (*AND FILTYP *NE +
' * * * ') (*AND FILSIZ *LE &SIZE)) +
FMTOPT(*MAP *DROP)
ENDDO
IF COND(&OP *EQ '*GE' *OR &OP *EQ '*ge') THEN(DO)
CPYF FROMFILE(QGPL/CUPFIL) +
TOFILE(QGPL/CUPFILQ) +
MBROPT(*REPLACE) INCREL((*IF FIL1 *EQ ' +
') (*AND FILNAM *NE 'Object ') (*AND +
FILTYP *NE ' Tota') (*AND FILTYP *NE +
' * * * ') (*AND FILSIZ *GE &SIZE)) +
FMTOPT(*MAP *DROP)
ENDDO
/* */
/* RUN CUQFILSIZ QUERY - PRINTS THE REPORT */
/* */
RUNQRY QRY(QGPL/CUQFILSIZ)
/* */
ENDPGM
Here is the source code for files CUPFIL and CUPFILQ:
A*
/* Member .....: CUPFIL */
/* Member type : DDS */
/* Description : Physical file of CUPFIL Records */
/* Compile ....: CRTPF FILE(QGPL/CUPFIL) + */
/* SRCFILE(YOURLIB/QDDSSRC) */
A* *
A R RFIL
A FIL1 3
A FILNAM 10
A FIL2 2
A FILTYP 10
A FILATT 10
A FIL3 3
A FILSIZ 13
A FIL4 2
A FILDSC 50
A*
/* Member .....: CUPFILQ */
/* Member type : DDS */
/* Description : Physical file of CUPFILQ Records */
/* Compile ....: CRTPF FILE(QGPL/CUPFILQ) + */
/* SRCFILE(YOURLIB/QDDSSRC) */
A* *
A R RFIL
A FILNAM 10
A FILTYP 10
A FILATT 10
A FILSIZ 13
A FILDSC 50
Here is the report definition for the query CUQFILSIZ:
5769QU1 V4R5M0 000526 IBM Query for AS/400 STOON 12/23/02 9:33:50 Page 1
Query . . . . . . . . . . . . . . . . . CUQFILSIZ
Library . . . . . . . . . . . . . . . QGPL
Query text . . . . . . . . . . . . . .
Query CCSID . . . . . . . . . . . . . . 65535
Query language id . . . . . . . . . . . ENU
Query country id . . . . . . . . . . . US
Collating sequence . . . . . . . . . . Hexadecimal
Processing options
Use rounding . . . . . . . . . . . . Yes (default)
Ignore decimal data errors . . . . . No (default)
Ignore substitution warnings . . . . Yes
Use collating for all compares . . . Yes
Special conditions
*** All records selected by default ***
Selected files
ID File Library Member Record Format
T01 CUPFILQ QGPL *FIRST RFIL
Ordering of selected fields
Field Sort Ascending/ Break Field
Name Priority Descending Level Text
FILNAM
FILTYP
FILATT
FILSIZ 10 D
FILDSC
Report column formatting and summary functions
Summary functions: 1-Total, 2-Average, 3-Minimum, 4-Maximum, 5-Count Overrides
Field Summary Column Dec Null Dec Numeric
Name Functions Spacing Column Headings Len Pos Cap Len Pos Editing
FILNAM 5 0 FILNAM 10
FILTYP 2 FILTYP 10
FILATT 2 FILATT 10
IBM Query for AS/400 12/23/02 9:33:50 Page 2
Report column formatting and summary functions (continued)
Summary functions: 1-Total, 2-Average, 3-Minimum, 4-Maximum, 5-Count Overrides
Field Summary Column Dec Null Dec Numeric
Name Functions Spacing Column Headings Len Pos Cap Len Pos Editing
FILSIZ 2 FILSIZ 13
FILDSC 2 FILDSC 50
Selected output attributes
Output type . . . . . . . . . . . . . . Printer
Form of output . . . . . . . . . . . . Detail
Line wrapping . . . . . . . . . . . . . No
Printer Output
Printer device . . . . . . . . . . . . *PRINT
Report size
Length . . . . . . . . . . . . . . . 66 (default)
Width . . . . . . . . . . . . . . . . 132
Report start line . . . . . . . . . . . 6
Report end line . . . . . . . . . . . . 60
Report line spacing . . . . . . . . . . Single space
Print definition . . . . . . . . . . . No
Printer Spooled Output
Spool the output . . . . . . . . . . . (Defaults to value in print file, QPQUPRFIL)
Form type . . . . . . . . . . . . . . . (Defaults to value in print file, QPQUPRFIL)
Copies . . . . . . . . . . . . . . . . 1
Hold . . . . . . . . . . . . . . . . . Yes
Cover Page
Print cover page . . . . . . . . . . . No
Cover page title
Page headings and footings
Print standard page heading . . . . . . Yes
Page heading
AS/400 File Sizes - Large Files
===============================
Page footing
IBM Query for AS/400 12/23/02 9:33:50 Page 3
* * * * * E N D O F Q U E R Y P R I N T * * * * *
This was first published in December 2002
