|
Hi Srikanth, > Is it possible to create multithreaded programs in RPGLE, some time back > I had coded multithreaded programs in C/400 using POSIX APIs (pthread > APIs). No, sorry. Unfortunately, RPG programs cannot be multi-threaded. The RPG compiler uses static storage for many of it's internal control structures in a manner that is not threadsafe. You can call an RPG program from a multi-threaded application by coding THREAD(*SERIALIZE) on the H-spec, but it's important to understand what that does -- it prevents multiple threads from running the RPG code concurrently... which usually defeats the purpose of making your application multi-threaded in the first place ;) > I now have do the same but in RPGLE, can I get some helpful links or > reference to sample programs. I checked out QUSRTOOL on my box but in > vain. An alternative might be to use more than one job instead of more than one thread -- in this environment, there's no issue with threadsafety. You can use sockets or data queues, etc to synchronize and pass data between the jobs. There may be other alternatives as well, depending on what you want to accomplish with the threads. Of course, you can always use Java or C to write a multi-threaded application on the iSeries. Starting in V5R1, C and RPG are part of the same package, so if you've got a license to use the RPG compiler, the same license lets you use the C compiler. And Java is free, I believe, in OS/400 -- comes with the operating system. Good Luck
As an Amazon Associate we earn from qualifying purchases.
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.