Arthur Frank writes:
> Is there any way to use LISTFILE to display files within a specified date
> range? Is this functionality available with MPE i/X 6.0? (We're
> currently on 5.5 pp6).
>
> Does anyone have a command file or UDC that does this sort of thing?
> No MPEX suggestions, please -- just plain, vanilla MPE.
And Mark Bixby replied with:
> I wrote a plain vanilla MPE command file that supports full FINFO()
> boolean expression selection criteria. From the top of the file:
<snipped rest of Mark post>
About 3 years ago I wrote a 'listfx' command file, attached below, that would
produce a 'listf' style output of a fileset showing the Create, Modify and
Access dates of each file. Just recently I enhanced it to include selection
criteria using the FINFO() function.
The command file is similar to Mark's. The main differences are:
It contains a number of 'predefined' selection parameters.
The date parameters can be specified relative to today's date.
Any of the 'other' finfo parameters can also be used.
A user can very easily 'customize it' for their own site.
From the command file:
parm z=@
anyparm filter = true
# ...
# ... LISTFX.UTIL.SYS
# ... Author: Paul H. Christidis [log in to unmask]
# ... Version : B.00.00(07/14/1999) Original Date: 09/08/96
# ...
# ... Command file that produces an 'extended' 'listf' output of a
# ... fileset. It includes the file name, owner, file code, record
# ... count, creation date, mod date, access date, and sector count,
# ... all on a single line per file. It can also 'select' using a
# ... number of, preset or user selectable, file attributes.
# ...
# Usage: LISTFX [fileset] [select_expression]
#
# Where:
# fileset = a :LISTFILE style fileset (If using the (fset,fset,..)
# format then it MUST be included in quotes).
#
# select_expression = an expression comprised of coded FINFO function
# calls. A number of 'predefined' finfo parms are included along
# with the capability of specifying any of the additional finfo
# parameters that one has memorized.
#
# The 'predefined' items/constants are:
# $fcode - The sting mnemonic for the file's file code.
# $icode - The integer value for the file's file code.
# $eof - The number of records in the file.
# $recsize - File's record size in 'positive' bytes.
# $credate - File's creation date.
# $moddate - File's last modification date.
# $accdate - File's last access date.
# $sectors - Number of sectors allocated to file.
# $today - The current day in 'yyyymmdd' format.
# $finfo( - To invoke any other 'finfo' item.
#
# Examples:
# :listfx @,$fcode = 'prog' OR $icode = 1030
#
# :listfx @,($fcode = 'prog' OR $icode = 1030) AND $accdate<>$today
#
# :listfx ./[B-W]@ $eof < 1000 AND $credate < $today-(30*18)
#
# :listfx "(./[B-W]@,/SYS/PUB/@)" $eof < 1000 AND $finfo("limit") > 25000
#
Regards
Paul H. Christidis
parm z=@
anyparm filter = true
# ...
# ... LISTFX.UTIL.SYS
# ... Author: Paul H. Christidis [log in to unmask]
# ... Version : B.00.00(07/14/1999) Original Date: 09/08/96
# ...
# ... Command file that produces an 'extended' 'listf' output of a
# ... fileset. It includes the file name, owner, file code, record
# ... count, creation date, mod date, access date, and sector count,
# ... all on a single line per file. It can also 'select' using a
# ... number of, preset or user selectable, file attributes.
# ...
# Usage: LISTFX [fileset] [select_expression]
#
# Where:
# fileset = a :LISTFILE style fileset (If using the (fset,fset,..)
# format then it MUST be included in quotes).
#
# select_expression = an expression comprised of coded FINFO function
# calls. A number of 'predefined' finfo parms are included along
# with the capability of specifying any of the additional finfo
# parameters that one has memorized.
#
# The 'predefined' items/constants are:
# $fcode - The sting mnemonic for the file's file code.
# $icode - The integer value for the file's file code.
# $eof - The number of records in the file.
# $recsize - File's record size in 'positive' bytes.
# $credate - File's creation date.
# $moddate - File's last modification date.
# $accdate - File's last access date.
# $sectors - Number of sectors allocated to file.
# $today - The current day in 'yyyymmdd' format.
# $finfo( - To invoke any other 'finfo' item.
#
# Examples:
# :listfx @,$fcode = 'prog' OR $icode = 1030
#
# :listfx @,($fcode = 'prog' OR $icode = 1030) AND $accdate<>$today
#
# :listfx ./[B-W]@ $eof < 1000 AND $credate < $today-(30*18)
#
# :listfx "(./[B-W]@,/SYS/PUB/@)" $eof < 1000 AND $finfo("limit") > 25000
#
setjcw insidempex=0
setvar mpexfinfoany 1
if "!z" <> "~" then
if BOUND(oldmsgfence) then
setvar hpmsgfence oldmsgfence
endif
setvar oldmsgfence hpmsgfence
setvar hpmsgfence 2
# ** Build temp file, set various variables and then **
# ** perform a listfile fset,6 to a temporary file. **
echo
purge listfilx,temp > $null
file listfilx;rec=-256,,v,ascii;disc=300000;nocctl;temp
setvar _lf_tfiles 0
setvar _lfpage 60
setvar _lftoday ![RHT(hpdatef,4)+RHT("0!hpmonth",2)+RHT("0!hpdate",2)]
setjcw cierror = 0
if insidempex = 0 then
setvar _lfrepl 'REPL'
continue
listfile !z,6 >*listfilx
else
setvar _lfrepl 'STRCHANGE'
continue
:listfile !z,6 >*listfilx
endif
if cierror = 0 then
setvar _lfch "."
if POS("/","!z") <> 0 then
setvar _lfch "/"
endif
setvar _lf_loop,finfo('*listfilx','eof')
file listfilx=listfilx,oldtemp;DEL
#
# Pass expression through file to preserve quotes (") or ('),
# replace tokens, validate and proceed to process file list.
#
echo !filter >lsfxtfil
input _lfselect <lsfxtfil
purge lsfxtfil,temp > $null
setvar _lfselect UPS(_lfselect)
setvar _lfselect &
!_lfrepl(_lfselect,"$TODAY" ,'_lftoday')
setvar _lfselect &
!_lfrepl(_lfselect,"$FCODE" ,'finfo(_lflnam,"fmtfcode")')
setvar _lfselect &
!_lfrepl(_lfselect,"$ICODE" ,'finfo(_lflnam,"intfcode")')
setvar _lfselect &
!_lfrepl(_lfselect,"$EOF" ,'finfo(_lflnam,"eof")')
setvar _lfselect &
!_lfrepl(_lfselect,"$RECSIZE",'- finfo(_lflnam,"recsize")')
setvar _lfselect &
!_lfrepl(_lfselect,"$CREDATE",'finfo(_lflnam,"intcreated")')
setvar _lfselect &
!_lfrepl(_lfselect,"$MODDATE",'finfo(_lflnam,"intmoddate")')
setvar _lfselect &
!_lfrepl(_lfselect,"$ACCDATE",'finfo(_lflnam,"intaccessed")')
setvar _lfselect &
!_lfrepl(_lfselect,"$SECTORS",'finfo(_lflnam,"sectors")')
setvar _lfselect &
!_lfrepl(_lfselect,"$FINFO(" ,'finfo(_lflnam,')
setvar _lflnam '*listfilx'
setjcw cierror = 0
continue
setvar _lft !_lfselect
if cierror = 0 then
xeq !hpfile ~ < *listfilx
else
echo ****
echo Invalid selection expression/Bad $token(s) specified
echo ****
endif
endif
if _lf_tfiles = 0 then
echo +-+-+ No files selected in fileset '!z' +-+-+
endif
#
# ******************* clean up *********************
#
setvar hpmsgfence oldmsgfence
if BOUND(traceon) then
showvar _lf@
else
deletevar mpexfinfoany, oldmsgfence, _lf@
endif
reset listfilx
return
# +*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
# + Section that parses the listfx file
# +*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
else
echo ![chr(27)+"&a0c-1R"+chr(27)+"J"+chr(27)+"&a0c-1R"]
setvar _lf_hdgroup , ' '
setvar _lf_hdacct , ' '
setvar _lftsect,0
setvar _lf_lcount,_lfpage
setvar _lf_pcount,0
setvar _lf_ffeed chr(12)
# ********************* loop *****************************
while SETVAR(_lf_loop, _lf_loop - 1) >= 0
# *** Get fcode, group, account, file name and fcreator ***
input _lf_record
setvar _lflnam,LTRIM(RTRIM(_lf_record))
if !_lfselect then
setvar _lf_tfiles _lf_tfiles + 1
setvar _lfcode ,LFT((finfo(_lflnam,'fmtfcode') + ' ' ),5)
setvar _lfgrp ,LFT((finfo(_lflnam,'group') + ' '),8)
setvar _lfacct ,LFT((finfo(_lflnam,'account') + ' '),8)
setvar _lffname &
,RTRIM(_lflnam - RTRIM("!_lfch!_lfacct") - RTRIM("!_lfch!_lfgrp")-"/")
if LEN(_lffname) <= 8 then
setvar _lfdname,LFT((_lffname + ' '),8)
setvar _lf_incr,1
else
setvar _lf_incr,2
setvar _lfdname '^ ^^^ ^ '
endif
setvar _lfowner,finfo(_lflnam,'owner')
setvar _lfowner,LFT(STR(_lfowner,1,POS('.',_lfowner)-1) + ' ',8)
# ** Get record & sector counts, accumulate total sectors **
setvar _lfRecs,RHT(' ' + "![finfo(_lflnam,'eof')]",8)
setvar _lfsect,RHT(' ' + "![finfo(_lflnam,'sectors')]",8)
setvar _lftsect, _lftsect + !_lfsect
setvar _lfaccs " "
if finfo(_lflnam,61) <> 0 then
setvar _lfaccs "*"
endif
# ******** Creation, Modification and Access dates *******
setvar _lfcdt,RHT(finfo(_lflnam,"created"), 12)
setvar _lfcdt,LFT(_lfcdt,1)+DWNS(STR(_lfcdt,2,5))+'/'+RHT(_lfcdt,2)
setvar _lfmdt,RHT(finfo(_lflnam,"modified"),12) &
+", "+finfo(_lflnam,"fmtmodtime")
setvar _lfmdt,LFT(_lfmdt,1)+DWNS(STR(_lfmdt,2,5))+'/'+STR(_lfmdt,11,2) &
+STR(_lfmdt,14,6) +DWNS(RHT(_lfmdt,2))
setvar _lfadt,RHT(finfo(_lflnam,"accessed"),12)
setvar _lfadt,LFT(_lfadt,1)+DWNS(STR(_lfadt,2,5))+'/'+RHT(_lfadt,2)
# ************* echo heading and file info *************
if _lf_lcount = _lfpage OR _lf_hdgroup <> _lfgrp &
OR _lf_hdacct <> _lfacct then
setvar _lf_pcount _lf_pcount + 1
setvar _lf_hdgroup '!_lfgrp'
setvar _lf_hdacct '!_lfacct'
setvar _lf_lcount, 0
echo ![_lf_ffeed]Account = !_lf_hdacct Group = &
!_lf_hdgroup !hpdatef, !hptimef Page: !_lf_pcount
echo
echo Filename Owner Code Records Sectors Cre-Date &
Mod-Date & time Acc-Date
echo -------- -------- ----- ------- ------- --------- &
----------------- ---------
endif
setvar _lf_lcount _lf_lcount + _lf_incr
if _lf_incr = 2 then
echo !_lffname
endif
echo !_lfdname!_lfaccs!_lfowner !_lfcode !_lfRecs !_lfsect !_lfcdt &
!_lfmdt !_lfadt
endif
endwhile
# *** END LOOP: display sector total if more than one file ***
if _lf_tfiles > 1 then
setvar _lfsect, '!_lftsect'
setvar _lfsect,RHT(' ' + '!_lfsect',9)
echo --------
echo Total Sectors: !_lfsect (!_lf_tfiles) Files
endif
echo
endif
#
return
|