IFSTOOL is a library containing
some ILE-RPG facilities for the Integrated File System (IFS).
All sources are included.
Minimum requirements are V4R5 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' . . . . . . . . . . . . __________________________________
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 . . . . . . . . . . . __________________________________
Print directories . . . . . . . *NO *NO, *YES
|
|
This command retrieves all objects in a given directory and in
nested directories. Objects are documented in database file
QTEMP/DIRLIST member IFSTOOL. Optionally the contents of this database file can be
printed. The following information is collected on the database file
for each object:
- object name (inclusive of path)
- object type
- object size (byte)
- date of the last change
The printout provides also a size subtotal for each directory and a
gross total.
Note 1.
In order to avoid excessive load on the interactive,
the program 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 . . . . . . . . . . . __________________________________
Text to search for . . . . . . . __________________________________
|
|
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 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
See an example of IFS events log (database file IFSTOOL/MONIFS).
Note 1
You may add triggers (command ADDPFTRG) to physical file
IFSTOOL/MONIFS to automate
your IFS control procedures.
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.
|