When you test your threaded application, you may want to quickly spawn new processes and debug the programs started in those processes. An example tool that creates a SPAWN CL command has been placed into the QUSRTOOL library for your use on the system. (See Creating the SPAWN command below.)
You can install the QUSRTOOL library (Option 7) of the base operating system when using the RSTLICPGM CL command. On the GO LICPGM menu, it appears as the Example Tools Library.
The spawn example shows how you might write a CL command and a command processing program to allow you to spawn jobs from the command line. The call to spawn() starts a new process that allows you to inherit the current environment (file descriptors, socket descriptors, and environment variables) from the current process. By default, it allows you to create threads in the child process and allows you to automatically issue the commands required to debug the spawned child. If you want more functionality from the command, you can easily edit it.
To use the example tool to create the SPAWN command, see the QATTINFO file in the QUSRTOOL library. The members AAAAREADME and AAAMAP in that file contain information and instructions for unpacking various QUSRTOOL examples and utilities. Read these members and follow the instructions for using the package and unpackage utilities on the SPAWN source files.
The member that contains the SPAWN example information is TP0ZINFO in the QATTINFO file. The TP0ZINFO member contains a table that lists the source files that must be unpacked to create the SPAWN example. The TP0ZINFO member also contains instructions for creating the example CL command and lists which source members are used for SPAWN in case you want to modify the SPAWN CL command to suit your own specific needs.
Pthread APIs | APIs by category |