EASY400 IFSTOOL - Get control on the IBM i IFS
 
  EASY400   |       iSeries-home
 
Public-source
 
EASY400
IFSTOOL
 
 Display the Change Log
 
 PDF of this tutorial
 
Download

 
IFSTOOL


  • To display the release date of your IFSTOOL, run command IFSTOOL/RELEASED
  • IFSTOOL Change Log at this page.


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:

  1. Command CHKIFSOBJ
  2. Command READDIR
  3. Command FIND
  4. Command SEARCH
  5. Command REPLACE
  6. Command CPYSTMF
  7. Command MONIFS
  8. Command WRKIFSREF
  9. Command GETOBJATTR
  10. Command PRTSTMF


 
1. Command CHKIFSOBJ (Check IFS object)

                          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) THEN(CHGVAR VAR(&MSG) +
                           VALUE(&OBJ *TCAT ' was found'))
              ELSE       CMD(CHGVAR VAR(&MSG) VALUE(&OBJ *TCAT ' was +
                           not found'))
              SNDPGMMSG  MSGID(CPF9897) MSGF(QSYS/QCPFMSG) MSGDTA(&MSG)
              RETURN
              ENDPGM
NOTES
  1. Use program IFSTOOL/TESTCHKIFS as a model for your program
  2. If your user profile is not authorized to the IFS objects, return will be negative
  3. WINDOWS network file paths should never be used. Use the System i native IFS addressing notation.


 
2. Command READDIR (Read directory)

                             Read directory (READDIR)

 Type choices, press Enter.

 Directory  . . . . . . . . . . .  DIR                                                
          
 Ignore stream files  . . . . . .  IGNSTMF     *NO           *NO, *YES
 Sub-directories to be ignored  .  IGNDIRS                                            
                + for more values                                                     
 Maximum subdirectory depth . . .  MAXDIRLVL   *NOMAX        Number, *NOMAX
          
 Stream file selection mask . . .  MASK        *NONE                                  
                                                                                      
 Print directories  . . . . . . .  PRINT                     *YES, *NO
 Execute completely in batch  . .  RUNBATCH                  *YES, *NO
 Display printout . . . . . . . .  DSPPRINT                  *YES, *NO
 Library of DIRLIST output file    OUTLIB      QGPL          Name
 Member of DIRLIST output file  .  OUTMBR      *USRPRF       Name, *USRPRF
This command retrieves all objects in a given directory and in nested directories.
When the value of paramter RUNBATCH is *NO, the execution is driven by the job issuing this command.
When the value of parameter RUNBATCH is *YES, a batch job is submitted to perform the requested activity.
The retrieved objects are documented in a database file named DIRLIST and residing
  • when RUNBATCH(*NO), in library QTEMP
  • when RUNBATCH(*YES), in the library specified in parameter OUTLIB.
For each object the following information is collected on the DIRLIST file:
  • object name (inclusive of path)
  • object type
  • object size (byte)
  • date of the last change
Optionally the contents of this database file can be printed. The printout 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 - Ignore stream files
    • Enter *NO to list all the stream files in a directory.
    • Enter *YES to obtain a reduced list of the contents of the given directory excluding the names of all the stream files there.
  • IGNDIRS - Use this parameter to specify up to 100 sub-directories for which you do not want the contents be reported. To ignore all sub-directories, specify the single value *ALL .
    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.
  • MAXDIRLVL - This parameter controls the maximum level of the subdirectories to be reported. Examples:
    • MAXDIRLVL(0) means that no subdirectories contents must be reported.
    • MAXDIRLVL(1) means that also the contents of level 1 subdirectories are to be reported.
    • MAXDIRLVL(*NOMAX) means that the contents of all subdirectories should be reported, regardless of the subdirectory levels.
  • MASK - Use this parameter to report back only the stream files with names matching a given patterned mask.
    Specify MASK(*NONE) to report all the existing stream files.
    Define the patterned mask by specifying a sequence of characters that must appear in the same sequence in a stream file name. Use character * as a wildcard. Mask characters are not case sensitive. Examples:
    • MASK('report*') intercepts all the stream file names starting by 'report'.
    • MASK('*report*') intercepts all the stream file names containing the string 'report'.
    • MASK('*2015*report*') intercepts all the stream file names containing the string '2015' and the string 'report' after it.
    • MASK( '*report*.pdf') intercepts all the stream file names containing the string 'report' and ending with string '.pdf' .
  • PRINT - Print directories . Enter *YES to generate a printout from output file DIRLIST.
  • RUNBATCH - Execute completely in batch. Enter:
    • *NO to execute the activity under control of the job issuing the command. We suggest to use this option when the expected number of retrieved objects is in the range of few thousands.
    • *YES to submit a job performing the requested activity. We suggest to use this option when the expected number of retrieved objects is very large (ten thousands or more).
  • DSPPRT - Display printout. This parameter is available only when PRINT(*YES) and RUNBATCH(*NO). Type
    • *YES to automatically display the printout of directories contents.
    • *NO not to display the printout. In this case, to display the printout you must enter command WRKJOB OPTION(*SPLF) and display the last spool file with name READDIR.
    • OUTLIB - Library of DIRLIST output file. This parameter is available only when RUNBATCH(*YES). Use it to specify the name of the library which should contain the output file DIRLIST. If the file does not yet exist in the specified library, it is automatically created.
    • OUTMBR - Member of DIRLIST output file. This parameter is available only when RUNBATCH(*YES). Use it to specify the name of the member in output file DIRLIST which should contain the output. If you specify *USRPRF, the member name will be the name of the current user profile. If the member specified does not yet exist, it is automatically added.
    Note 1. When RUNBATCH(*NO), 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.

     
    3. Command FIND (Find IFS objects)

                                   Find IFS objects (FIND)
    
     Type choices, press Enter.
    
      Base directory . . . . . . . . . BASEDIR   /                                                                               
      Object name pattern  . . . . . . PATTERN   *                                                                               
      Print results  . . . . . . . . . PRINT     *YES   *YES, *NO
      Display printout . . . . . . . . DSPPRT    *YES   *YES, *NO
    This command provides a list of all objects in a directory (and in nested directories) with names matching a given pattern.
    The output is database file QTEMP/FNDRES.
    Comments on parameters:
    • BASEDIR - Path name of the directory to be processed. Also its subdirectories are investigated.
      • 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*
    • PATTERN - Object name pattern.
      Use this parameter select only the IFS objects with names matching the specified pattern.
      1. Use PATTERN(*) to accept all IFS object names,
        OR
      2. In parameter PATTERN type a character string that must exist in the selected IFS object names, and use character * as a wildcard.
        Examples:
        • PATTERN('report*') selects all IFS objects names starting by string "report".
        • PATTERN('*report') selects all IFS objects names ending by string "report".
        • PATTERN('*report*') selects all IFS objects names containing string "report".
        Note. PATTERN characters strings are NOT case sensitive.
    • PRINT - Print results.
      Whether physical file QTEMP/FNDRES, containing the search results, should be printed.
    • DSPPRT - Display printout.
      Whether the printout should be displayed (if an interactive job).


     
    4. Command SEARCH (Search a character string)

                  Search a string in a given IFS directory (SEARCH)
    
     Type choices, press Enter.
    
      Directory  . . . . . . . . . . . DIR       __________________________________
      Char. string to be searched  . . TEXT      __________________________________
      Stream file name pattern . . . . PATTERN   __________________________________
      Restrict search to HTML stmf's . HTMLONLY  *NO    *YES, *NO
      Search also HTML tags  . . . . . HTMLTAG   *NO    *YES, *NO
      Display search results . . . . . DISPLAY   *YES   *YES, *NO
    This command provides a list of all stream file in a directory (and in nested directories) containing a given character string. The output is database file QTEMP/SCHRES.
    Comments on some parameters:
    • DIR - Path name of the directory to be searched.
      • 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*
    • TEXT - Character string to be searched.
      It is case insensitive.
    • PATTERN - Stream file name pattern.
      Use this parameter to process only the stream files with names matching the specified pattern.
      Specify PATTERN(*NONE) to process all the existing stream files.
      Define the name pattern by specifying a sequence of characters that must appear in the same sequence in a stream file name. Use character * as a wildcard. Pattern characters are not case sensitive.
      Examples:
      • PATTERN('report*') intercepts all the stream file names starting by 'report'.
      • PATTERN('*report*') intercepts all the stream file names containing the string 'report'.
      • PATTERN('*2015*report*') intercepts all the stream file names containing the string '2015' and the string 'report' after it.
      • PATTERN('*report*.pdf') intercepts all the stream file names containing the string 'report' and ending with string '.pdf' .
    • HTMLONLY - Restrict search to HTML stmf's.
      Select
      • *YES to restrict the search only to stream files with extension HTML or HTM.
      • *NO to search all the stream files.
    • HTMLTAG - Search also HTML tags.
      Select
      • *YES to search the character string also within HTML tags
      • *NO to ignore HTML tags.
    • DISPLAY - Display search results.
      Whether physical file QTEMP/SCHRES, containing the search results, should be displayed.


     
    5. Command REPLACE (Replace character strings)

                  Replace string in stream files (REPLACE)
    
     Type choices, press Enter.
    
      IFS Directory / stream file  . . DIR     _______________________________
      Process also subdirectories  . . SUBDIRS *NO    *YES, *NO
      Char. string to be replaced  . . ARGUM   _______________________________
      ________________________________________________________________________
      ________________________________________________________________________
      _____________________________________________________
      Replacement char. string . . . . REPLACE _______________________________
      ________________________________________________________________________
      ________________________________________________________________________
      _____________________________________________________
      Stream file name pattern . . . . PATTERN *NONE_________________________
      ________________________________________________________________________
      ____________________
      Keep original stmf's . . . . . . KEEP    *YES   *YES, *NO
      Delete kept original stmf's  . . DLTKEPT *NO    *YES, *NO
      Monitor changes  . . . . . . . . MONITOR *NO    *YES, *NO
      List changed stream files  . . . LIST    *YES   *YES, *NO
    Use this command to replace a character string in the stream files of an IFS directory and related subdirectories.
    (Note - Stream files with CCSID 1208 (UTF-8) are not supported, will be ignored and in the final report will be flagged with status code *ERR 5 .)
    • IFS Directory / stream file (DIR) - You may specify a given stream file or a directory.
      If you specify a directory, all the stream files in that directory and in the related subdirectories will be examined for potential character string replacements.
    • Process also subdirectories (SUBDIRS) - Whether also stream files on the subdirectories (of the directory in parameter DIR) should be investigated.
    • Char. string to be replaced (ARGUM) - This character string (max 200 characters) will be searched in all the investigated stream files, and - whenever found - it will be replaced with the character string defined in parameter REPLACE.
      • If you need it, you may specify a hexadecimal character string. Example: ARGUM(X'0D') .
      • Instead of a character string, you may type *NONE. In this case you are not asking for a character string replacement, you are asking to delete all the original stream files previously saved (kept) after been renamed as (OLD)originalStreamFile_OLD. In this case you must specify parameter DLTKEPT(*YES) .
      • Original stream files previously saved with names like (OLD)originalStreamFile_OLD are no longer subject to string replacements by command REPLACE. However, they will be substituted when a new version of their "originalStreamFile" needs to be saved (kept).
    • Replacement char. string (REPLACE) - This character string (max 200 characters) will replace the searched character string, whenever found in the investigated stream files.
      • If you need it, you may specify a hexadecimal character string. Example: REPLACE(X'0D0A') .
    • Stream file name pattern (PATTERN) - Use this parameter to process only the stream files with names matching the specified pattern.
      Specify PATTERN(*NONE) to process all the existing stream files.
      Define the name pattern by specifying a sequence of characters that must appear in the same sequence in a stream file name. Use character * as a wildcard. Pattern characters are not case sensitive. Examples:
      • PATTERN('report*') intercepts all the stream file names starting by 'report'.
      • PATTERN('*report*') intercepts all the stream file names containing the string 'report'.
      • PATTERN('*2015*report*') intercepts all the stream file names containing the string '2015' and the string 'report' after it.
      • PATTERN('*report*.pdf') intercepts all the stream file names containing the string 'report' and ending with string '.pdf' .
    • Keep original stmf's (KEEP) - Type *YES if you want to keep (save) the original versions of modified stream stream files. The original versions are then renamed as (OLD)originalStreamFile_OLD.
    • Delete kept original stmf's (DLTKEPT) - Type *YES if you want to delete all the ex-original stream files renamed as (OLD)originalStreamFile_OLD in previous runs of command IFSTOOL/REPLACE.
    • Monitor changes (MONITOR) - If you specify *YES, you are displayed every characters-replacement case and your confirmation is requested, see the example.
    • List changed stream files (LIST) - Specify *YES to generate a list of all the stream files which did undergo character string replacements.
      The following is an example of such a list after running command
      REPLACE DIR('/letters') SUBDIRS(*YES)
      ARGUM('Kind regards,') REPLACE('Best regards,')
      KEEP(*YES) DLTKEPT(*NO) LIST(*YES)
            Objects processed by command IFSTOOL/REPLACE page 1
      Status Object
      -DONE- /letters/letter7.txt
      -DONE- /letters/UK/letter52.txt

      Meanings of column "Status":

      -DONE- stream file was modified (string replacements took place) and its original version was saved as
      '(OLD_)' + OriginalStreamfileName + '_OLD'
      *ERR 1 stream file could not be accessed (security issue)
      *ERR 2 a stream (OLD_) version could not be deleted (security issue) and string replacements, though feasable, could not be done.
      *ERR 3 an (OLD_) version of a stream file could not be created (security issue) and string replacements, though feasable, could not be done
      *ERR 4 original stream file could not be renamed or deleted (security issue)
      *ERR 5 error in supporting CCSID 1208 (Unicode) of an original stream file
     
    6. Command CPYSTMF (Copy stream files)

    This command copies selected stream files from an IFS directory to another IFS directory and optionally converts them from their CCSIDs to another CCSID.
    The following features are available:

    • You may copy stream files from a flat directory to another flat directory
    • You may copy stream files from a directory tree to a flat directory
    • You may copy stream files from a directory tree to another directory tree (missing subduirectories are automaticakly created)
    • You may keep the same CCSID, convert to another stmf and data CCSID, or convert just the stmf CCSID without converting the stmf data
    • Stream files to be copied are selected through a stream file name pattern where the wildcard character * can be used up to 20 times
    • A report is optionally generated.

                            Copy stream files (CPYSTMF)
    
     Type choices, press Enter.
    
                                                                     
     From directory . . . . . . . . . FRDIR      > '/a'                                                              
                                           
     From subdirectories  . . . . . . FRSUBDIR     *ALL          *NONE, *ALL
     To directory . . . . . . . . . . TODIR      > '/tmp'                                                            
                                           
     To subdirectories  . . . . . . . TOSUBDIR     *NONE        *NONE, *SAME
     To CCSID . . . . . . . . . . . . TOCCSID    > *SAME         37-65535, *SAME, UTF8
     Keep data unchanged  . . . . . . BINARY       *NO           *YES, *NO
     From name pattern  . . . . . . . FRNAME     > *ALL                                                              
                                            
     From name extension  . . . . . . FREXT        *ALL           Character value 
     Replace the "TO" stream file . . REPLACE      *NO           *YES, *NO
     Print results  . . . . . . . . . PRINT        *YES          *YES, *NO      
     Display printout . . . . . . . . DSPPRINT     *NO           *YES, *NO
    • From directory (FRDIR) - The IFS directory containing the stream files to be copied.
    • From subdirectories (FRSUBDIR) - Whether also stream files in the subdirectories of directory FRMDIR will be copied. Specify:
      • *NONE to ignore subdirectory stream files
      • *ALL to copy also the stream files existing in the subdirectories of directory FRMDIR.
    • To directory (FRDIR) - The IFS directory where the stream files will be copied.
    • To subdirectories (TOSUBDIR) - This parameter is available only when FRSUBDIR(*ALL) is specified. It tells whether the "from" subdirectory stream files will be copied to subdirectories of the receiving directory having the same names. Select one of the following:
      • *NONE to copy all the "from" selected subdirectory stream files to the main "to" directory.
      • *SAME to copy the "from" selected subdirectory stream files into receiving subdirectories having the same name.
      Note: If a receiving subdirectory does not yet exist, it is automatically created.
    • To CCSID (TOCCSID) - The CCSID to which copied stream files will be converted.
      • If *SAME* specified, no CCSID conversion takes place.
      • You may enter value UTF8 to mean UTF-8 CCSID 1208.
    • Convert CCSID only (BINARY) - As a rule, both the stream file CCSID and its data are converted to the CCSID specified in parameter TOCCSID.
      However, if you want to convert just the stream file CCSID and keep the stream file data unchanged, specify BINARY(*YES).
      Note: This parameter is not available when TOCCSID(*SAME) is specified.
    • From stream file name (FRNAME) - A name pattern used to select the stream files to be copied.
      One or more characters * can be used as a wild characters. Examples:
      • FRNAME('payroll.pdf') selects only stream files fully matching the specified stream file name.
      • FRNAMEFRNAME('pay*') selects all the stream files with a name startingby "pay".
      • FRNAME('*.pdf') selects all the stream files with a name ending by ".pdf".
      • FRNAME('p*.pdf') selects all the stream files with a name starting by "p" and ending by ".pdf".
      • FRNAME('m*t*') selects stream files with names like "mother.jpg", "meteo.pdf', "multinational", and so on.
    • From name extension (FREXT) - Optionally, you may specifify to select only the stream files having a given extension (example: .HTML).
      You may leave the default value *ALL to mean that all extensions are good for selection.
    • Replace the "TO" stream file (REPLACE) - Specifies whether the target stream file is replaced if it already exists.
    • Print results (PRINT) - Whether a printout should be generated.
    • Display printout (DSPPRINT) - Whether the generated printout should be displayed.

    Quick rules
    1. To copy from a flat directory to another flat directory: FRSUBDIR(*NONE) and TOSUBDIR(*NONE)
    2. To copy from a tree directory to a flat directory: FRSUBDIR(*ALL) and TOSUBDIR(*NONE)
    3. To copy from a tree directory to another tree directory: FRSUBDIR(*ALL) and TOSUBDIR(*ALL)
    4. to avoid CCSID conversion: TOCCSID(*SAME)
    5. to convert both stmf CCSID and stmf data: TOCCSID(value) and BINARY(*NO)
    6. to convert just the stmf CCSID but leaving the stmf data unchanged: TOCCSID(value) and BINARY(*YES)


     
    7. 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.

                     Monitor IFS events (MONIFS)
    
     Type choices, press Enter.
    
     Starting date and time:           FROMTIME                                            
       Starting date  . . . . . . . .           *CURR         Date, *CURR, *RESUME          
       Starting time  . . . . . . . .           *CURR         Time (hhmmss), *CURR, *RESUME 
     Ending date and time:             TOTIME                                            
       Ending date  . . . . . . . . .           *NEVER        Date (YYMMDD), *CURR, *NEVER  
       Ending time  . . . . . . . . .           *NEVER        Time (hhmmss), *NEVER         
     IFS direct.s to be monitored . .  IFSDIR   *ALL          *ALL, *DEFINED
     Wait on IFS object locks . . . .  LOCKWAIT *YES          *YES, *NO
     Maximum wait time (seconds)  . .  MAXWAIT  900           5-86400
                       

    Use this command to start a trace of IFS events on database file IFSTOOLDTA/MONIFS (library IFSTOOLDTA is automatically created during IFSTOOL installation).
    This is done by 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
     
    Note on IFS symbolic links - Audit Journal does not report events related to symbolic links, it reports events related to their linked IFS physical objects.
    The following information is recorded on records of database file IFSTOOLDTA/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

    Parameter FROMTIME (Starting date and time)
    Specifies the date and time of the first journal entry considered for reception. The starting date and time of the first journal entry created either at or after the specified starting date and time is the starting point for reception of the journal entries.

    • Element 1: Starting date - Specify a starting date (6 digits) in the format defined in system value QDATFMT.
      Alternatively you may specify one of the following special values:
      • *CURR to specify the current date
      • *RESUME to specify the date when the previous MONIFS command was ended
    • Element 2: Starting time - Specify a starting time in the format hhmmss (hours, minutes, seconds).
      Alternatively you may specify one of the following special values:
      • *CURR to specify the current time (this special value is automatically assumed when *CURR is specified for the starting date)
      • *RESUME to specify the time when the previous MONIFS command was ended (this special value is automatically assumed when *RESUME is specified for the starting date).
    Parameter TOTIME (Ending date and time)
    The ending date and time of the journal entry created at or before the specified ending date and time is the ending point for reception of the journal entries.
    • Element 1: Ending date - Specify an ending date (6 digits) in the format YYMMDD (Year Month Day).
      Alternatively you may specify the following special value:
      • *NEVER to specify that the reception of journal entries should continue without any date limit
    • Element 1: Ending time - Specify an ending time in the format hhmmss (hours, minutes, seconds).
      Alternatively you may specify the following special value:
      • *NEVER to specify that the reception of journal entries should continue without any time limit (this special value is automatically assumed when *NEVER is specified for the ending date).
    Note - When *NEVER specified for the "Ending date and time", you may later on specify a different "Ending date and time" through command ENDMONIFS.
    Parameter IFSDIR (IFS directories to be monitored):
    • *ALL - All the IFS directories should be monitored.
    • *DEFINED - Only the IFS directories specified through command IFSTOOL/WRKMONDIR should be monitored.
    Parameter LOCKWAIT (Wait on IFS object locks):
    • *YES - If a journal entry is a related to an IFS under lock, wait until the lock is ended before writing a record to file MMAILDATA/MONIFS.
      During this wait time, a message is sent to the joblog every 5 minutes, so that one can know about the IFS object being locked.
    • *NO - Do not check for IFS object locks, write a record to file MMAILDATA/MONIFS as soon as a journal entry is received.
    Parameter MAXWAIT (Maximum wait time (seconds)):
    This parameter is available only when LOCKWAIT(*YES). It establishes the maximum wait time (in seconds) the program should wait - on an IFS object lock - before tracing the IFS event on file IFSTOOLDTA/MONIFS if the object lock did not yet end.

    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')
    Note - You can do that by simply executing command IFSTOOL/STRAUDJRN (Start Audit Journal).
    To end generating the audit journal entries needed by command MONIFS, you may just run command IFSTOOL/ENDAUDJRN.

    Command IFSTOOL/MONIFS starts, on database file IFSTOOLDTA/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 LOCKWAIT(*YES))

    If you then add a trigger (via command ADDPFTRG) to database file IFSTOOLDTA/MONIFS (see the NOTE 1 later in this page), you may obtain on the IFS the same level of control / automation that you may achieve on files of the library system.

    Command MONIFS 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 IFSTOOLDTA/MONIFS:
      • Time stamp of the IFS event
      • IFS Object type (*DIR or *STMF)
      • IFS object path (name)
      • Operation performed on the IFS object:
        • 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 IFSTOOLDTA/MONIFS to automate your IFS control procedures. Example:
ADDPFTRG FILE(IFSTOOLDTA/MONIFS) TRGTIME(*AFTER) TRGEVENT(*INSERT)
   PGM(IFSTOOL/MONIFSTRG) RPLTRG(*YES)
   TRG(MYTRIGGER) TRGLIB(*FILE)

Library IFSTOOL includes a sample trigger program IFSTOOL/MONIFSTRG.
This trigger program, added to file IFSTOOLDTA/MONIFS,
sends a message to message queue IFSTOOLDTA/MONIFSTRG
for each IFS event detected from command IFSTOOL/MONIFS.

Of course, your trigger program(s) do not have to be in library IFSTOOL. They have better be in some 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 sizes 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.

                 End Monitor IFS events (ENDMONIFS)

 Type choices, press Enter.

 Ending date and time:             ENDTIME                                            
   Ending date  . . . . . . . . .           *CURR         Date (YYMMDD), *CURR, *NEVER  
   Ending time  . . . . . . . . .           *CURR         Time (hhmmss), *CURR, *NEVER
                   
Use this command to schedule an ending date and time for an ongoing MONIFS activity. This command resets any previous MONIFS ending date and time.

 
8. Command WRKIFSREF (Work with IFS object references)

                     IFS Object References (WRKIFSREF)          

 Type choices, press Enter.

 Object . . . . . . . . . . . . .  OBJ      __________________________________
____________
                   

This command lists all the jobs in the system which are currently referencing a given IFS object.
Object reference (example: "Read Only, Share with Readers Only") is reported for each job in the list.
This command may help in finding jobs that are inhibiting access to a given IFS object.
Options are provided to end selected jobs.


 
9. Command GETOBJATTR (Get IFS object attributes)

                     Get IFS object attributes (GETOBJATTR)

 Type choices, press Enter.

 Object path name  . . . . . . . . OBJPATH  ____________________________________
___________________
 Pre-clear the ouput files . . . . CLEAR    *YES          *YES, *NO
 Display the ouput files . . . . . DSP      *NO           *YES, *NO
                   

This command retrieves the attributes of a user specified IFS object and returns them in two files automatically generated in library QTEMP:

  1. File QTEMP/OBJATTRS. This file is added a single record containing information about attributes such as object type, owner, size, creation date, last change date, and so on (for detail information, DSPFFD IFSTOOL/OBJATTRS).
  2. File QTEMP/OBJUSERS. This file is added a record for each objectuser (example: *PUBLIC and the object owner). These records contain information regarding the access permissions to these users (for detail information, DSPFFD IFSTOOL/OBJUSERS).

Why is the command information provided through some QTEMP files, instead of something different, such as an user space?
This was done on purpose, to enable RPG programmers - though not familiar with API's - to process with their programs a list of objects, for instance to find out which IFS stream files could be deleted by the *PUBLIC.
As a matter of fact one could use - as input to command GETOBJATTR - the list of IFS objects provided by command READDIR in physical file DIRLIST.

Looking for a useful example of the information provided by this command? See this page.

Command parameters:

  • OBJPATH - Object path name - Path name of the IFS object.
    If the object is not found or cannot be accessed, a diagnostic message is returned.
  • CLEAR - Pre-clear the ouput files - Whether QTEMP output files OBJATTRS and OBJUSRS should be cleared before adding records for the current object.
    Use of parameter CLEAR - If you want to collect on these QTEMP files information about several objects,
    • Issue command IFSTOOL/GETOBJATTR CLEAR(*YES) for the first IFS object
    • Issue command IFSTOOL/GETOBJATTR CLEAR(*NO) fot the other IFS objects.
  • DSP - Display output files - Display the output files (DSP) - Whether QTEMP output files OBJATTRS and OBJUSRS should be displayed after having been added the object attribute records.

Note - The program of this command takes advantage of the IFS Unix Api Qp0lGetAttr(), not the easiest one to work with.


 
10. Command PRTSTMF (Print a stream file)

No system command is available to print a stream file.
Command IFSTOOL/PRTSTMF does it.


                     Print a stream file (PRTSTMF)

 Type choices, press Enter.
 Stream file  . . . . . . . . . . >   STMF  ________________________________
_________________
 Type of representation . . . . . >  *CHR   *CHR   *CHR, *HEX
 Display printout . . . . . . . . >   DSP   *YES   *YES, *NO  

Command parameters:

  • STMF - Stream file - Path and name of the stream file to be printed
  • TYPE - Type of representation- Wheter the printout must be in characters or in hexadecimal values.
  • DSP - Display printout - Wether the printout must be displayed.






contact us contact us