COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Example 304 Report Produced by PPD Command
NAME PID1 PID2 ANCESTOR
$Z000 00,022 01,021 00,021
$CRT2 00,021 01,022 $Z000
$NULL 07,004 00,024 00,025
$CMON 07,005 00,026 00,025
$IMON 00,031 01,025 06,010
$DM00 00,032 $IMON
$DM01 01,024 $IMON
...
The report in Example 304 shows that the process-pair named $Z000 consists of a primary process
running in processor module 00 with the process identification number (PIN) 022 and a backup
process running in processor 01 with the PIN 021. The processor and PIN of the process that
started $Z000 (its ancestor) is 00,021. Notice that not all processes are executing as process
pairs—$DM00 and $DM01 (parts of the Inspect symbolic debugger) are running as single
processes.
Every disk volume name, device name, spooler collector name, and so on, begins with a dollar
sign. Each time you read from or write to one of them, you are reading from or writing to the
process controlling that entity.
Example of Simple Interprocess Communication
This example illustrates the principles of interprocess communication using named processes and
$RECEIVE (see Figure 42).
The program PITCHER accepts a line of text from its home terminal and transmits it to the process
$CATCH (the program named CATCHER). When it receives a line beginning with the value “END,
PITCHER terminates after transmitting the line.
CATCHER displays each line on its home terminal. When the process that opened CATCHER
terminates, an HP COBOL run-time routine translates the closure as an end of file (EOF) on
$RECEIVE. The AT END phrase of the READ statement passes control around the DISPLAY statement,
the PERFORM terminates because its UNTIL phrase is satisfied, and CATCHER terminates. (Use of
an empty declarative would eliminate the need for the END-TRANS paragraph and the AT END
GO TO construct.)
Figure 42 $RECEIVE From PITCHER to CATCHER
The bold text in Example 305 is significant. Note that, in PITCHER, the file for CATCHER is opened
for I-O even though it is being used only for output. If you open a process with the OUTPUT or
EXTEND attribute, HP COBOL handles the process as a printer device and tries to advance it to
the next page—an operation that is meaningless (and fatal) to CATCHER.
Example 305 PITCHER Code
IDENTIFICATION DIVISION.
PROGRAM-ID. PITCHER.
AUTHOR. JO COBOL.
INSTALLATION. TRANSACTIONS ANONYMOUS.
Communicating With a Process 921