IFS trigger function

Hi Experts,

I prefer to use a Webservice for this kind of requirements, but that is not in scope in this question

So I have to write a trigger (or trigger-like program) on the IFS, that will be fired when a File is added to a specified path (or even a specific file extention)
Writing a NEP is no option because of the immediate action I have to take.
I found the next options:
  1. Use an ExitProgram on QIBM_QP0L_SCAN_CLOSE
  2. set Journaling to the specific IFS-path
  3. .... any other sugestion is more then welkome

Defining the Exit program keep telling me :
CPF3CE5 ; Exit point QIBM_QP0L_SCAN_CLOSE with format SCCL0100 will not allow exit program MyEXIT library MyLIB to be added.                    
I also not convinced that this is the right way, because every close action in the IFS will trigger this program (not only one specific path I assume)

Journaling is maybe better but:
RCVJRNE seems to loop through all entries and give unreadable data to my program (lots of questionmarks).

I'm out of ideas... don't know what I have to specify to solve this.
LVL 17
Theo KouwenhovenApplication ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Theo KouwenhovenApplication ConsultantAuthor Commented:
Hi Experts,

Some extra info:
The IFS map can be a remote mounted filesystem or Local

IBM info tells me that I need to define some Program Data:
"When you register the exit program, the following program data must be provided. The following table shows the structure of the program data information. For a description of the fields in this format, see Field Descriptions. This structure is defined in header file qp0lscan.h as data type Qp0l_Scan_Program_Data_t."

Offset      Type      Field
Dec      Hex
0      0      Char(10)      User profile
10      A      Char(20)      Scan key
30      1E      Char(12)      Scan key signature

This last info doesn't make it any clearer for me?
What scan key?
What signature?
Gary PattersonVP Technology / Senior Consultant Commented:
The scanning exit points are primarily for use by antivirus software.  You can use them for what you want to do, but that isn't the primary purpose.  You'll need to configure the scanning system values appropriately, write exit programs (they need to be thread-safe), and properly register the exit programs.  If you use IBM i based AV software, you'll need to avoid conflicts.

This API has lots of conditions and restrictions:


CPF3CE5 means that you had an error on ADDEXITPGM - most likely, you didn't specify (or correctly specify) the  required Exit Program Data (PGMDTA) parameter for this Exit Point: User Profile, Scan Key, and Scan Signature.  This exit point is designed to be used by multiple applications for a variety of purposes, and can be registered to up to 50 different exit programs.  The User Profile, Scan Key, and Scan Signature are fields that you can define distinguish your exit program from others.

You can find the descriptions of these fields here in the "Field Descriptions" sections:


The User Profile is the *USRPRF object that the Exit program you create will run under.  Make sure this profile has *USE rights to the exit program object.

Scan key and scan key signature are explained here, and are designed to allow AV vendors to minimize the number of times an IFS object is scanned, for example if the object was scanned when it was created, and hasn't been changed in a significant way since.


You'll also need to define proper values for your application for a couple of scanning-related system values (QSCANFSCTL and QSCANFS):


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gary PattersonVP Technology / Senior Consultant Commented:
Setting up journaling to cover the specific directories you are interested in is going to be the simpler solution to implement, in my opinion.  If you're having trouble, provide your code and a dump of data that is creating problems for you.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Theo KouwenhovenApplication ConsultantAuthor Commented:
Hi Gary,

Thanks for the response, I tried figure-out how to read the Journal-entries, and found a layout I can use (Type4),
I'm not sure if this is the right format, for my purpose, but tests will learn :-)
Gary PattersonVP Technology / Senior Consultant Commented:
I don't know what different mechanisms can be used to create the IFS files you need, but make sure and test them and look at the journal entries generated.  For example, it isn't uncommon for a process (especially PASE/QShell processes) to create a file in a temporary location, write to the temp file, close the temp file, and the and them MOVE the file to a destination folder only once it is finalized.  If you are just journaling a particular subset of directories, you would miss the create and close events, and only see the MOVE event.

You will probably be interested in journal entries of the following types:

B/B0: IFS object create summary - If you use this to trigger an action that reads the IFS file, you may need to delay execution until you get the B/CS entry - otherwise you may start processing the file before it has been completely written.  Haven't used this in a while, though, and don't have code sample available, so just make sure you test by creating a veery large file, or delaying closing the file to see thepattern of journal entries you get if this is a concern.

B/CS: IFS object closed

B/ B3: IFS object moved - If the file is created in another location and moved into the destination directory, you may have to watch for this entry.  Object name requires pointers + offset to locate.


Be aware of additional complexities if you use commitment control: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/ifs/rzaaxspecial.htm

- Gary
Theo KouwenhovenApplication ConsultantAuthor Commented:
Hi Gary,

Thanks, I asked my comm.partner if it's possible to send a record to a PF with FTP Append, that would make it a lot easier.
But I will try your suggestion anyway. :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.