× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

well - yes there is multi threading in ILE-RPG - at least kinda. I have prepared a very rough example on my blog:

https://qpgmr.de/a-multi-treading-example-in-ile-rpg-using-pthread-apis

The example source is on GitHub:

https://github.com/qpgmr-de/examples

But be warned - the Pthread API is not very "RPGish" - it's a POSIX/Unix API, which is more C oriented.

But if you are careful when spawning new threads and extra careful when joining them again, it should work. Simply always keep track of your threads in an array.

And - you have to submit your job with ALWMLTTHD(*YES) - so only batch jobs can do multi threading.

HTH
Daniel


Am 19.01.2024 um 18:56 schrieb smith5646midrange@xxxxxxxxx:

When we refresh our test environments, there are some HUGE files that we
strip down after they are restored. Because we can't just strip down all
files, these specific files are kept in a driver file.



There is an RPGLE program that reads through the driver file. If the file
exists (already restored) and it is not locked (still being restored), the
program checks to see if the file exceeds the number of records to be kept.
If so, it strips it down. If the process does not find the file (not yet
restored) or it is locked (currently being restored), it bypasses it and
trips a flag so that the program knows that it needs to loop through the
driver file again to catch what was missed. When all of the files exist,
none of them are locked, and they are all below the record count threshold,
it ends. Due to the way it was written, this is single threaded processing.
I need to be able to multi thread the process and I really don't want to
have to rewrite the program to submit individual jobs.



Is there a "threading" process in RPG that would allow the RPG program to
process multiple files at the same time? I've tried to google but I'm
apparently not searching for the correct keywords.

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.