CLNSPL - cleanup old spools
Cette page a été mise
à jour le14
delete old spool files depending on their age
RPG, User space and pointers : the shortest code I've do to explore a list of spools
Cleanup old spools (CLNSPL)
Yet an other spool cleaner.
tool a day I was on a site without internet access. (yes, it's already
today). Not possible to get a free existing tool on the web.
Because I was in position to write again a spool-list-reader, I decide to make it a little spicy.
I've try to answer this question : what is the lesser number of RPG calculation statement required to walk a spool-file-list ?
answer is 4 :
the first is the API to get the list
// get list of spools
the second if the API to get a pointer on the list (LAH mean List-Api handler)
// use LAH as a mask to format & read the user space
the third is a FOR to loop the list :
for iSpl= 0 to lah.count - 1;
the forth is to get the data from one entry of the list :
// get data to load element
Now, you know what is the heart of this tool, you can look at the code.
CLNSPLR rpg program is finally 239 lines long ... plus the JP4* include toolbox.Debug mode : if you want to test the tool, you can change it to just list the spools to delete :
last version : How to upload to my 400
to compile :
CHGPFM FILE(JPLTOOLS) MBR(CLNSPL) SRCTYPE(CMD) TEXT('Clean old spools')
CHGPFM FILE(JPLTOOLS) MBR(CLNSPLR) SRCTYPE(RPGLE) TEXT('Clean old spools')
CRTCMD CMD(CLNSPL) PGM(CLNSPLR) SRCFILE(JPLTOOLS)
CRTRPGMOD MODULE(CLNSPLR) SRCFILE(JPLTOOLS) OPTION(*NODEBUGIO *SRCSTMT *SHOWCPY *SECLVL *EXPDDS) DBGVIEW(*ALL) REPLACE(*YES) TGTRLS(V5R3M0) ENBPFRCOL(*FULL)
CRTPGM PGM(CLNSPLR) BNDDIR(QC2LE JPLTOOLS) ACTGRP(JPLTOOLS) OPTION(*DUPPROC) TGTRLS(V5R3M0)
The source code is provided as an open source tool under the GNU General Public License, version 2. In summary, this license specifies:
By clicking the download link you acknowledge and agree to the terms of the license.
THIS TOOLBOX IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROVIDER OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS TOOLBOX, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.