COBOL Manual for TNS and TNS/R Programs
Process Initiation, Communication, and 
Management
HP COBOL Manual for TNS and TNS/R Programs—522555-006
31-4
Initiating a Process From an HP COBOL Program
•
The number of memory pages the new process is to be allocated (optional)
•
A numeric data item in which the operating environment is to return the process ID 
(name, processor number, and number of process within that processor) after the 
process is created (optional and of little use to the HP COBOL programmer)
•
A numeric data item in which the operating environment is to return a diagnostic 
code indicating the success of the process creation (optional, but recommended)
For a syntax diagram of the CREATEPROCESS routine and complete descriptions of 
its parameters, see CREATEPROCESS.
In Example 31-1, CREATEPROCESS initiates two independent processes. Note the 
mechanism used to decompose the 2-byte computational GIVING item into its two 
single-byte portions.
Note. If the process is running at a high PIN, the process ID that the operating 
environment returns is synthetic. For information about synthetic IDs of high-PIN 
processes, see the Guardian Application Conversion Guide.
Example 31-1. CREATEPROCESS Routine (page 1 of 3)
?SEARCH $SYSTEM.SYSTEM.COBOLLIB
 IDENTIFICATION DIVISION.
 PROGRAM-ID. LAUNCHER.
 AUTHOR. DANA COBOL.
 INSTALLATION. TRANSACTIONS ANONYMOUS.
 DATE-WRITTEN. 29 FEBRUARY 1988.
 DATE-COMPILED.
***********************************************************************
* This program initiates two other processes and then it terminates *
***********************************************************************
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER. HP TXP.
 OBJECT-COMPUTER. HP TXP.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01 FAMILY.
 05 P PIC X(21).
 05 COB-PROC-1 PIC X(21) VALUE "$WONDER.TWEEDLE.DUM".
 05 COB-PROC-2 PIC X(21) VALUE "$WONDER.TWEEDLE.DEE".
 05 PROC-NAME PIC X(6).
 05 SEND-STD-STARTUP-MSG PIC S9(4) COMP VALUE 2.
 05 SU-ERROR PIC S9(4).
 05 NEWPROCESS-ERR-LEFT PIC 9(4).
 05 NEWPROCESS-ERR-RIGHT PIC 9(4).
 05 PROC-FAILED PIC X(16) VALUE "Failed to start ".
 05 PROC-ID PIC S9(18) COMP.
 PROCEDURE DIVISION.
 AA-1.
* Start $QUEEN process
 MOVE "$QUEEN" TO PROC-NAME.










