Skip to main content  
        iSeries home   |   Easy400  
Public-Source
 
 Introduction
 
 
About it
Prerequisites
Installation
Command CHKIFSOBJ
Procedure RtvIfsObjI()
Updates
 
 Display Change log
 Download
 
 

 
ChkIFSobj
Command to check the existence of an IFS object
by Giovanni B. Perotti (Italy)

1-About it

This is a public source utility for IBM System i.
It features a command and a procedure to check whether a user specified IFS object exists.

2-Prerequisites

  • OS/400 release V5R2 or subsequent
  • Compiler ILE RPG IV, product 57xxWDS, opt. 31, is required during the installation phase.

3-Installation

  • Download file chkifsobj.zip from the Easy400 download page and unzip it.
  • Follow the chkifsobj.txt instructions to upload and to restore library CHKIFSOBJ.
  • On the IBM System i
    • sign on with a user profile having *SECADM special authority
    • run the following procedure:
      STRREXPRC SRCMBR(INSTALL) SRCFILE(CHKIFSOBJ/QREXSRC)
      It does the following:
      • creates objects in library CHKIFSOBJ.
      • restores IFS directory /chkifsobj .

4-Command CHKIFSOBJ

Command CHKIFSOBJ/CHKIFSOBJ checks the existence of a user-specified IFS object:
                          Check IFS object (CHKIFSOBJ)                          
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 'Object' . . . . . . . . . . . . OBJ      >                                              
      
Command CHKIFSOBJ
This command checks an IFS object.
  • If the object is found, it returns an information message. The second level text of this message contains useful information about the IFS object.
  • If the object is not found (or the user profile is not authorized to access it) it returns an escape error message. The second level text of this message contains information about the error.

Example of a successful command:

Move the cursor to the message first level text and press F1 to display the second level text:

Example of an unsuccessful command:

Please note that the command ended into an escape error message.
Move the cursor to the message first level text and press F1 to display the second level text:

See the following example about using command CHKIFSOBJ in a CL program (member SAMPLE1 in CHKIFSOBJ/QCLSRC):

             PGM                                                           
                                                                           
             CHKIFSOBJ/CHKIFSOBJ OBJ('/tmp/myText.txt')                    
             MONMSG     MSGID(MSG0002) EXEC(DO) /* if the IFS object +     
                          not found, ... */                                
             EDTF       STMF('/tmp/myText.txt')                            
             ENDDO                                                         
                                                                           
             ENDPGM
Sample CL program

4-Procedure RtvIfsObjI() Retrieve IFS Object Information

This procedure (exported from service program CHKIFSOBJ/CHKIFSOBJ)

  • Returns a data structure containing three indicators:
    • existence indicator (set to *on if the IFS object exists)
    • read indicator (set to *on if the user profile can read this IFS object)
    • write in dicator (set to *on if the user profile can write this IFS object)
    • execute indicator (set to *on if the user profile can execute or search this IFS object)
  • Has a mandatory input parameter:
    • The path of the IFS object
  • Returns the following optional parameters:
    • object type (example: *STMF)
    • object size
    • object code page
    • object CCSID
    • timestamp when object data was last changed
    • timestamp when object attribute was last changed
    • timestamp when object was last accessed
    • error code (if any errors)
    • error message (if any errors)

Example (see member SAMPLE2 in CHKIFSOBJ/QRPGLESRC):

 /copy chkifsobj/qrpglesrc,hspecs                                         
 /copy chkifsobj/qrpglesrc,hspecsbnd                                      
 /copy chkifsobj/qrpglesrc,proto                                          
                                                                          
 * Indicators returned from procedure RtvIfsObjI()                        
D objAccInds      ds                                                      
D  existenceInd                   n                                       
D  readInd                        n                                       
D  writeInd                       n                                       
D  executeInd                     n                                       
                                                                          
 * Mandatory parameter input to procedure RtvIfsObjI() (can be a constant)
D objpath         s            256    varying                             
                                                                          
 * Parameters returned from procedure RtvIfsObjI()
D objtype         s             11    varying
D objsize         s             20u 0
D objCodePage     s              5u 0
D objCCSID        s              5u 0
D objDChgStamp    s               z                                        stamp of data change
D objAChgStamp    s               z                                        stamp of attr change
D objAccStamp     s               z                                        stamp of last access
D C_Errno         s             10i 0
D C_ErrText       s            256    varying

 /free

      objAccInds=RtvIfsObjI('/chkifsobj/html/page1.htm':
                            objtype:objsize:
                            objCodePage:objCCSID:
                            objDChgStamp:objAChgStamp:objAccStamp:
                            C_Errno:C_ErrText);
                    
      return;                          
                

5-Updates

To know about the latest updates to this tool, press this link.
To know about the release date of the CHKIFSOBJ version you may have installed, on your IBM i system execute command CHKIFSOBJ/RELEASED .