One thing that I should note here. I am a really crappy C programmer. I
would imagine that any C programmer that looked at my code would laugh him
or herself to death but I make it work. Just not very good at it.

One other note. In C, I use multi-threading and pre-start jobs because RPG
programs are not thread-safe. The threads handle the conversation with the
socket client and the pre-start jobs are just RPG programs that do the RPG

In RPG, you switch to a pre-start job to handle the conversation with the
socket client and run the RPG work.

On Wed, Oct 27, 2021 at 6:52 AM Alan Campin <alan0307d@xxxxxxxxx> wrote:

<< Okay. Now comes the interesting question: There is no fork() call in
IBM i. How exactly is this "forking" done?>>
The C programming language has a multi-threading library which is why I
use C. I can "fork" a new thread to handle a conversation. <<My opinion
only but I think you have to be crazy to use multi-threading in RPG. Just
asking for it and so incredibly heavy>>

Please note that the same thing can be done in RPG by transferring to a
pre-start job. There are different ways of skinning the same cat. In C, you
fork a new thread to handle the conversation. In RPG, you switch to a
pre-start job.

Pre-start jobs are just a way to start one to many jobs and have them
waiting in a suspended state. They are part of the subsystem description.
The operating system provides function calls that allow me to activate and
switch processing to one of these pre-start jobs. Because the job is
already running, it starts almost instantaneously. All of this stuff is C
api's. If I am programming in C, I use the api directly. If RPG, I have
written service programs that wrap this stuff up.

On Wed, Oct 27, 2021 at 1:55 AM Patrik Schindler <poc@xxxxxxxxxx> wrote:

Hello Alan,

Am 26.10.2021 um 16:06 schrieb Alan Campin <alan0307d@xxxxxxxxx>:

No, that is not how socket servers work. The socket server is just
sitting and listening for connection requests. When it gets one it forks a
new process.

Okay. Now comes the interesting question: There is no fork() call in IBM
i. How exactly is this "forking" done?

That process receives the request and then spawns a new job to do the
processing. That job is a pre-start job so it can start instantaneously.

You mean, it can *run* instantaneously, yes? What are the important bits
of the innards of a PJ program? I did not find information about that yet.
What triggers it to run instead just lingering around activated (by the
SBS?)? What needs to be done to make it go back to
activated-but-finished-with-work state? Especially in hindsight on C being


:wq! PoC

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related

Help support by shopping at with our affiliate

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 by 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.