CICS operator communication enables application programs to send messages to system operators and receive responses. This capability is essential for alerting operators to critical conditions, requesting manual intervention, and enabling two-way communication between applications and operations staff.
Operator communication in CICS uses specialized commands that allow programs to interact with the operator console, send notifications, and receive operator input. This is particularly important for error handling, system monitoring, and situations requiring human decision-making.
Operator communication in CICS provides a bridge between application programs and system operators who monitor and manage the CICS region. This communication is bidirectional:
Imagine you're playing a game and you need help from a grown-up. In CICS, your program is like you playing the game, and the operator is like the grown-up who can help.
When your program needs help or wants to tell the operator something important, it uses WRITE OPERATOR - like writing a note and giving it to the grown-up. The note might say "I need help!" or "Something went wrong!" or "Everything is working fine!"
Sometimes, your program might need to wait for the grown-up to answer a question. That's when it uses READ OPERATOR - like waiting for the grown-up to write back on your note. The program waits patiently until the operator responds, then it can continue with what it was doing.
The WRITE OPERATOR command sends a message to one or more system operators. This is the primary mechanism for applications to communicate with operators.
123456789EXEC CICS WRITE OPERATOR TEXT(message-text) [TEXTLENGTH(length)] [ROUTE(operator-id | operator-class | ALL)] [OPCLASS(operator-class)] [DEST(destination)] [RESP(response-code)] [RESP2(response2-code)] END-EXEC.
| Option | Description | Required |
|---|---|---|
| TEXT | The message text to send to operators. Can be a literal or data area containing the message. | Yes |
| TEXTLENGTH | Length of the message text. Required if TEXT is a data area, optional for literals. | Conditional |
| ROUTE | Specifies routing destination: operator ID, operator class, or ALL for all operators. | No |
| OPCLASS | Specifies an operator class to receive the message. All operators in the class receive it. | No |
| DEST | Specifies a destination identifier for message routing. | No |
| RESP | Response code field to check command execution status. | No |
| RESP2 | Additional response code providing detailed error information. | No |
123456789101112131415161718192021222324252627282930IDENTIFICATION DIVISION. PROGRAM-ID. OPMSG01. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-MESSAGE PIC X(80). 01 WS-RESP PIC S9(8) COMP. 01 WS-RESP2 PIC S9(8) COMP. PROCEDURE DIVISION. MAIN-PARA. *> Send a simple informational message MOVE 'Customer file backup completed successfully' TO WS-MESSAGE. EXEC CICS WRITE OPERATOR TEXT(WS-MESSAGE) TEXTLENGTH(LENGTH OF WS-MESSAGE) RESP(WS-RESP) RESP2(WS-RESP2) END-EXEC. *> Check if command executed successfully IF WS-RESP NOT = DFHRESP(NORMAL) THEN *> Handle error condition DISPLAY 'WRITE OPERATOR failed: ' WS-RESP END-IF. EXEC CICS RETURN END-EXEC.
You can route messages to specific operators or operator classes using the ROUTE or OPCLASS options:
1234567891011121314151617181920*> Send message to a specific operator EXEC CICS WRITE OPERATOR TEXT('Critical error detected in transaction ABC') ROUTE('OP001') RESP(WS-RESP) END-EXEC. *> Send message to all operators in a class EXEC CICS WRITE OPERATOR TEXT('Database connection pool exhausted') OPCLASS('DATABASE') RESP(WS-RESP) END-EXEC. *> Send message to all operators EXEC CICS WRITE OPERATOR TEXT('System maintenance window starting in 5 minutes') ROUTE(ALL) RESP(WS-RESP) END-EXEC.
The READ OPERATOR command allows a program to read messages or commands from operators. This enables two-way communication and allows operators to provide input to running transactions.
12345678EXEC CICS READ OPERATOR INTO(data-area) [LENGTH(data-area)] [MAXLENGTH(length-value)] [WAIT(timeout-value)] [RESP(response-code)] [RESP2(response2-code)] END-EXEC.
| Option | Description | Required |
|---|---|---|
| INTO | Data area where the operator message will be placed. | Yes |
| LENGTH | Data area that receives the actual length of the message read. | No |
| MAXLENGTH | Maximum length of message to read. Prevents buffer overflow. | No |
| WAIT | Timeout value in seconds. Program waits for operator input up to this time. If omitted, waits indefinitely. | No |
| RESP | Response code field to check command execution status. | No |
| RESP2 | Additional response code providing detailed error information. | No |
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253IDENTIFICATION DIVISION. PROGRAM-ID. OPAPPROV. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-OPERATOR-INPUT PIC X(80). 01 WS-INPUT-LENGTH PIC S9(4) COMP. 01 WS-RESP PIC S9(8) COMP. 01 WS-RESP2 PIC S9(8) COMP. 01 WS-APPROVAL PIC X(1). PROCEDURE DIVISION. MAIN-PARA. *> Send message requesting approval EXEC CICS WRITE OPERATOR TEXT('Large transaction detected. Approve? (Y/N)') ROUTE(ALL) RESP(WS-RESP) END-EXEC. *> Wait for operator response (30 second timeout) EXEC CICS READ OPERATOR INTO(WS-OPERATOR-INPUT) LENGTH(WS-INPUT-LENGTH) MAXLENGTH(80) WAIT(30) RESP(WS-RESP) RESP2(WS-RESP2) END-EXEC. *> Check if we got a response IF WS-RESP = DFHRESP(NORMAL) THEN *> Process operator response MOVE WS-OPERATOR-INPUT(1:1) TO WS-APPROVAL IF WS-APPROVAL = 'Y' OR WS-APPROVAL = 'y' THEN *> Proceed with transaction DISPLAY 'Transaction approved by operator' ELSE *> Cancel transaction DISPLAY 'Transaction cancelled by operator' EXEC CICS RETURN END-EXEC END-IF ELSE *> Timeout or error - take default action IF WS-RESP = DFHRESP(ENDDATA) THEN DISPLAY 'No operator response - using default' ELSE DISPLAY 'READ OPERATOR error: ' WS-RESP END-IF END-IF. EXEC CICS RETURN END-EXEC.
Operator classes are groups of operators that share similar responsibilities or authorization levels. Using operator classes allows you to route messages to operators with specific roles without knowing individual operator IDs.
| Class | Description | Typical Use |
|---|---|---|
| SYSTEM | System operators with full system access | Critical system messages, shutdown requests |
| SECURITY | Security administrators | Security violations, authentication failures |
| DATABASE | Database administrators | Database errors, connection issues |
| APPLICATION | Application support staff | Application errors, transaction issues |
1234567891011121314151617181920*> Send security alert to security operators EXEC CICS WRITE OPERATOR TEXT('Multiple failed login attempts detected') OPCLASS('SECURITY') RESP(WS-RESP) END-EXEC. *> Send database error to database administrators EXEC CICS WRITE OPERATOR TEXT('DB2 connection pool exhausted - immediate action required') OPCLASS('DATABASE') RESP(WS-RESP) END-EXEC. *> Send system message to system operators EXEC CICS WRITE OPERATOR TEXT('System resource usage exceeds threshold') OPCLASS('SYSTEM') RESP(WS-RESP) END-EXEC.
Operator messages can be categorized by type and severity. Understanding these categories helps you send appropriate messages and ensures operators respond appropriately.
| Message Type | Description | Example | Severity |
|---|---|---|---|
| Informational | Messages that provide status information or confirmations | Transaction completed successfully | Low |
| Warning | Messages that alert operators to potential issues | Disk space usage exceeds 80% | Medium |
| Error | Messages that indicate errors requiring attention | File access failed - file not found | High |
| Critical | Messages that require immediate operator intervention | System resource exhausted - immediate action required | Critical |
Match message severity to the actual situation. Overusing critical messages can lead to operator fatigue and reduce effectiveness.
123456789101112131415*> Good: Appropriate severity *> Critical system resource issue EXEC CICS WRITE OPERATOR TEXT('CRITICAL: System storage exhausted - immediate action required') OPCLASS('SYSTEM') RESP(WS-RESP) END-EXEC. *> Bad: Overstating severity *> Routine operation completion EXEC CICS WRITE OPERATOR TEXT('CRITICAL: Daily report generation completed') ROUTE(ALL) RESP(WS-RESP) END-EXEC.
Messages should be clear, concise, and provide enough information for operators to take action:
123456789101112131415161718*> Good: Clear and actionable MOVE 'File CUSTFILE access failed - File not found. ' & 'Check file definition and ensure file is enabled. ' & 'Transaction ID: CUST, Program: CUSTINQ' TO WS-MESSAGE. EXEC CICS WRITE OPERATOR TEXT(WS-MESSAGE) OPCLASS('APPLICATION') RESP(WS-RESP) END-EXEC. *> Bad: Vague and unhelpful EXEC CICS WRITE OPERATOR TEXT('Error occurred') ROUTE(ALL) RESP(WS-RESP) END-EXEC.
Don't send operator messages for routine operations or in tight loops. Use logging or journaling for routine information:
123456789101112131415161718192021222324252627*> Bad: Sending message in a loop PERFORM VARYING WS-INDEX FROM 1 BY 1 UNTIL WS-INDEX > 1000 EXEC CICS WRITE OPERATOR TEXT('Processing record number') RESP(WS-RESP) END-EXEC END-PERFORM. *> Good: Use logging for routine operations PERFORM VARYING WS-INDEX FROM 1 BY 1 UNTIL WS-INDEX > 1000 *> Process record *> Log to journal instead of operator console EXEC CICS WRITE JOURNAL JFILE('APPLOG') FROM(WS-LOG-RECORD) RESP(WS-RESP) END-EXEC END-PERFORM. *> Only send operator message for summary EXEC CICS WRITE OPERATOR TEXT('Batch processing completed - 1000 records processed') OPCLASS('APPLICATION') RESP(WS-RESP) END-EXEC.
When using READ OPERATOR, always specify a timeout and handle timeout conditions gracefully:
1234567891011121314151617181920212223*> Good: Timeout handling EXEC CICS READ OPERATOR INTO(WS-OPERATOR-INPUT) LENGTH(WS-INPUT-LENGTH) MAXLENGTH(80) WAIT(60) RESP(WS-RESP) END-EXEC. IF WS-RESP = DFHRESP(NORMAL) THEN *> Process operator response PERFORM PROCESS-OPERATOR-INPUT ELSE IF WS-RESP = DFHRESP(ENDDATA) THEN *> Timeout - take default action DISPLAY 'Operator timeout - using default action' PERFORM DEFAULT-ACTION ELSE *> Error condition DISPLAY 'READ OPERATOR error: ' WS-RESP PERFORM ERROR-HANDLING END-IF END-IF.
Avoid including sensitive information like passwords, account numbers, or personal data in operator messages. Use references or codes instead:
1234567891011121314*> Bad: Includes sensitive information EXEC CICS WRITE OPERATOR TEXT('User JOHN123 password reset requested. New password: ABC123') OPCLASS('SECURITY') RESP(WS-RESP) END-EXEC. *> Good: Uses reference instead EXEC CICS WRITE OPERATOR TEXT('Password reset requested for user ID: USER001. ' & 'Reference: REQ-2024-001234') OPCLASS('SECURITY') RESP(WS-RESP) END-EXEC.
Always check response codes when using operator communication commands. Common error conditions include:
| Exception Condition | Description | Recommended Action |
|---|---|---|
| NOTAUTH | Program not authorized to use operator communication commands | Check resource security definitions and program authorization |
| LENGERR | Message length error - text too long or invalid length specified | Verify message length and TEXTLENGTH parameter |
| ENDDATA | READ OPERATOR timeout - no operator response received | Handle timeout condition and take appropriate default action |
| INVREQ | Invalid request - invalid operator ID, class, or destination | Verify operator IDs, classes, and routing parameters |
123456789101112131415161718192021222324252627282930313233343536373839EXEC CICS WRITE OPERATOR TEXT(WS-MESSAGE) TEXTLENGTH(WS-MESSAGE-LENGTH) OPCLASS('SYSTEM') RESP(WS-RESP) RESP2(WS-RESP2) END-EXEC. EVALUATE WS-RESP WHEN DFHRESP(NORMAL) *> Success - message sent CONTINUE WHEN DFHRESP(NOTAUTH) *> Not authorized - log and continue DISPLAY 'WRITE OPERATOR not authorized' *> Alternative: Write to journal instead EXEC CICS WRITE JOURNAL JFILE('APPLOG') FROM(WS-MESSAGE) RESP(WS-RESP) END-EXEC WHEN DFHRESP(LENGERR) *> Length error - truncate or split message DISPLAY 'Message too long - truncating' COMPUTE WS-MESSAGE-LENGTH = 80 EXEC CICS WRITE OPERATOR TEXT(WS-MESSAGE(1:80)) TEXTLENGTH(80) OPCLASS('SYSTEM') RESP(WS-RESP) END-EXEC WHEN OTHER *> Other error - log and handle DISPLAY 'WRITE OPERATOR error: ' WS-RESP DISPLAY 'RESP2: ' WS-RESP2 END-EVALUATE.
Task: Write a CICS program that sends a message to operators when a file access fails.
Requirements:
Task: Create a program that requests operator approval before processing a large transaction.
Requirements:
Task: Write a program that sends different messages to different operator classes based on error type.
Requirements:
CICS operator communication provides essential capabilities for applications to interact with system operators. Key points to remember:
Effective operator communication enhances system monitoring, enables operator intervention when needed, and provides a mechanism for applications to request human decision-making in critical situations.
1. What is the primary purpose of the WRITE OPERATOR command in CICS?
2. Which option allows you to send a message to operators in a specific operator class?
3. What happens if you use READ OPERATOR without specifying a timeout?
4. What is the maximum length of a message that can be sent using WRITE OPERATOR?
5. Which command allows a CICS program to receive input from operators?
Learn about comprehensive message handling strategies in CICS applications including error messages, user notifications, and system communications
Understanding error handling mechanisms and exception condition management in CICS programs
Learn about CICS operations control facilities and system management commands