*IF* you have control of the job stream, an option that I've used in the
past is to send a "sentinel" file after the data. Your NEP can monitor for
the sentinel and then it knows the data transfer is complete.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry C. Adams
Sent: Thursday, February 13, 2014 6:11 AM
To: 'Midrange Systems Technical Discussion'
Subject: RE: Trigger on IFS Folder?
Thanks, Scott and everyone.
I didn't think it was possible, but thought it was worth asking the pros.
I know what you mean about the NEP processing an open file, Scott. I had a
program that read orders pushed from our retail stores. Worked fine - until
my NEP kicked in while the store was downloading its details so I got half
of the order! Not that it matters for this thread, but that was all in a
QSYS library.
Jerry C. Adams
IBM i Programmer/Analyst
If you hold a cat by the tail, you learn things you cannot learn any other
way. -Mark Twain
--
Home Office: 615-832-2730
email: midrange@xxxxxxxx
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, February 12, 2014 4:35 PM
To: Midrange Systems Technical Discussion
Subject: Re: Trigger on IFS Folder?
No, not exactly.
What you can do is attach a journal to an IFS directory. It's possible to
have an NEP that sits on the RCVJRNE API -- with the proper parameters, it
can cause your program to react immediately upon something happening to an
IFS file.
However, there are some caveats, too. Often programs will open a file to
create it, then close it without writing any data, then open it again
later to write the data, then close it again... so this makes it
really hard to detect when the program is actually done with the file.
Other times, programs will create the file under a different name, do their
thing, then rename it to the proper name when they're done.
Again, very hard to detect when they're done with the file.
I took my best shot at writing a program to handle it properly, it involved
delaying for a second or two after the file was created, then trying to get
exclusive use of the object (by using the open IFS API with O_SHARE_NONE).
This was mostly successful, but certainly can be
fooled... If you'd like to check out my attempt, I put it into an
article with downloadable code, here:
http://iprodeveloper.com/rpg-programming/run-program-automatically-when-file
-uploaded-ifs
There's also a utility available from Easy400.net called MONIFS that I think
works similarly? But haven't tried it, myself.. might be worth looking into
as well.
On 2/12/2014 4:18 PM, Jerry C. Adams wrote:
This is just a matter of curiosity. I have applied triggers to
database files, but I was wondering if it was possible to apply a
trigger to a non-QSYS folder in the IFS? That is, possible
application, which I'm thinking about, is if a file is dropped into
\FolderJA could I have a trigger program that would automatically be
invoked to process files in the folder?
In the past I just had a NEP that checked every, oh, 15-60 minutes to
see if there was anything there.
Thanks.
Jerry C. Adams
IBM i Programmer/Analyst
You are the result of 4 billion years of evolutionary success. Act
like
it.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.