|
IFSTOOL is a library containing
some ILE-RPG facilities for the Integrated File System (IFS).
All sources are included.
Minimum requirements are V5R2 and ILE-RPG compiler for the
installation.
Facilities are accessed through a number of commands:
- Command CHKIFSOBJ
- Command READDIR
- Command SEARCH
- Command MONIFS
- Command CHKIFSOBJ
Check IFS object (CHKIFSOBJ)
Type choices, press Enter.
'Object' . . . . . . . . . . . . OBJ
Result . . . . . . . . . . . . . RESULT Logical value
|
|
This command checks an IFS object and returns a logical variable:
- '0' - object not accessible (either not found
or not authorized to it)
- '1' - object found
This command can be run only in interactive and
batch programs.
Sample CL program using this command:
PGM
DCL VAR(&OBJ) TYPE(*CHAR) LEN(256)
DCL VAR(&RESULT) TYPE(*LGL) LEN(1)
DCL VAR(&MSG) TYPE(*CHAR) LEN(200)
/*=======*/
CHGVAR VAR(&OBJ) VALUE('/qibm')
IFSTOOL/CHKIFSOBJ OBJ(&OBJ) RESULT(&RESULT)
IF COND(&RESULT *EQ '1') THEN(CHGVAR VAR(&MSG) +
VALUE(&OBJ *TCAT ' was found'))
IF COND(&RESULT *NE '1') THEN(CHGVAR VAR(&MSG) +
VALUE(&OBJ *TCAT ' was not found'))
SNDPGMMSG MSGID(CPF9898) MSGF(QSYS/QCPFMSG) MSGDTA(&MSG)
RETURN |
- Command READDIR
Read directory (READDIR)
Type choices, press Enter.
Directory . . . . . . . . . . . DIR
Print directories . . . . . . . PRINT *NO *NO, *YES
Ignore stream files . . . . . . IGNSTMF *NO *NO, *YES
Sub-directories to be ignored . IGNDIRS
+ for more values
|
|
This command retrieves all objects in a given directory and in
nested directories. Objects are documented in database file
QTEMP/DIRLIST member IFSTOOL.
The QTEMP library is that of the job running command READDIR.
Optionally the contents of this database file can be
printed.
The following information is collected for each object on the database file QTEMP/DIRLIST:
- object name (inclusive of path)
- object type
- object size (byte)
- date of the last change
The printout (spool file READDIR) provides also a size subtotal for each directory and a
gross total.
Comments on some parameters.
- DIR - Path name of the directory to be processed.
- Must start with a /
- A generic path name (ending with an *) is also supported
- Examples:
/qibm/ProdData/Java400
/qibm/ProdData/Java400/Hello
/qibm/ProdData/D*
- IGNSTMF(*YES) - If specified, only directories are listed. Stream files within a directory are not reported.
- IGNDIRS - Use this parameter to specify up to 100 sub-directories for which you do not want the contents be reported.
In the following example:
Read directory (READDIR)
Type choices, press Enter.
Directory . . . . . . . . . . . DIR '/hssfcgi'
Print directories . . . . . . . PRINT *YES *NO, *YES
Ignore stream files . . . . . . IGNSTMF *NO *NO, *YES
Sub-directories to be ignored . IGNDIRS '/hssfcgi/html'
+ for more values '/hssfcgi/java'
|
|
the contents of sub-directories /hssfcgi/html and /hssfcgi/java are not listed.
Note 1.
In order to avoid excessive load on the interactive subsystem,
the program, if running in an interactive session, submits a batch job to perform the huge work.
The batch job provides the results to the submitting job,
which then resumes execution.
- Command SEARCH
Search HTML text in directory (SEARCH)
Type choices, press Enter.
Directory . . . . . . . . . . . DIR __________________________________
Text to search for . . . . . . . TEXT __________________________________
Search also HTML tags . . . . . HTMLTAG *NO *YES, *NO
|
|
This command provides a list of all objects in a directory (and in
nested directories) containing a given text. Only objects with
extension ".htm" or ".html" are processed. The output is database
file QTEMP/SCHRES.
Note 1. For parameter DIR, see command READDIR.
Note 2.
This command takes advantage of command
ifstool/readdir.
- Command MONIFS (Monitor IFS events)
You can have some programs of yours getting control on events occurring on the IFS by
using commmand IFSTOOL/MONIFS.
The basic requirement is that Audit Journal is active on your system.
If you do not know how to implement this, just run the following commands:
- CRTJRNRCV JRNRCV(QSYS/QAUDJRNRCV) AUT(*ALL)
- CRTJRN JRN(QSYS/QAUDJRN) JRNRCV(QSYS/QAUDJRNRCV) AUT(*ALL)
- CHGSYSVAL SYSVAL(QAUDCTL) VALUE(*AUDLVL)
- CHGSYSVAL SYSVAL(QAUDLVL) VALUE('*CREATE *DELETE *OBJMGT')
Command IFSTOOL/MONIFS starts, on database file IFSTOOL/MONIFS,
a non-ending trace of IFS events.
We suggest that you run this command in batch, example:
sbmjob monifs jobq(qsysnomax) cmd(IFSTOOL/MONIFS)
By adding triggers (command ADDPFTRG)
to this database, you may obtain on the IFS the same level of control / automation
that you may achieve on files of the library system.
This command operates receiving Audit Journal entries.
The user profile running this command must have
special authority *AUDIT.
The following events are detected:
- Create
- Delete
- Move / Rename
- Restore
- Authority change
- Ownership change
The following information is recorded on records of database file
IFSTOOL/MONIFS:
- Time stamp
- Object type
- Object name
- Operation performed:
- CREATED
- REPLACED
- UNLINKED
- DELETED
- MOVED
- RENAMED
- AUTHORITY-GRANTED
- AUTHORITY-GRANTED WITH REPLACE
- AUTHORITY-REVOKED
- AUTHORITY-GRTUSRAUT
- RESTORED EXISTING OBJECT
- RESTORED NEW OBJECT
- OWNER CHANGED
- Result of operation
- If move / rename: new object name.
- If authority change: affected user profile.
- If change of ownership: previous owner -> new owner.
- Job performing the event
Display an example of IFS events log (database file IFSTOOL/MONIFS)
viewed through Excel (check out our utility HSSFCGI/TABLEXLS).
Note 1
You may add triggers (command ADDPFTRG) to physical file
IFSTOOL/MONIFS to automate
your IFS control procedures. Example:
ADDPFTRG FILE(IFSTOOL/MONIFS) TRGTIME(*AFTER) TRGEVENT(*INSERT)
PGM(IFSTOOL/MONIFSTRG) RPLTRG(*YES)
TRG(MYTRIGGER) TRGLIB(*FILE)
For an example of trigger program IFSTOOL/MONIFSTRG, see
this page.
Of course, your trigger program(s) do not have to be in library IFSTOOL.
They have better be in a library of yours, so that they do not get lost the next time you
download and re-install library IFSTOOL.
Note 2
Starting with V5R2, the iSeries Navigator Management Central
provides tools to monitor changes and size of IFS files,
including string search.
Command IFSTOOL/MONIFS provides ways
to monitor for IFS files existence and authority changes.
By combining the two tools, one may implement a complete
auditing strategy on the IFS.
|