Now that we have the ability to perform I/O we can think about communicating with a device.  We will start with the beginnings of an operator console.  We will use a locally attached 3270 device as the our console.  We will need to have a UCB defined for the device.

To begin we will start with providing the ability to write to the console.  To do this we need to define two new control blocks.  The first is the Console Communication Block (CCB) and the other is the Console Message Buffer (CMB).

The CCB defines a console and is the anchor for the console buffers.

@CCB     DSECT ,                  CONSOLE COMMUNICATIONS BUFFER 
CCBNEXT  DS    A                  NEXT CONSOLE                  
CCBMBQ   DS    A                  MESSAGE BUFFER QUEUE          
CCBFMQ   DS    A                  FREE MESSAGE QUEUE            
CCBECB   DS    F                  MESSAGE AVAILABLE ECB         
CCBDEV   DS    XL2                CONSOLE DEVICE ADDRESS        
CCBQLEN  DS    XL2                QUEUE LENGTH

It begins with a pointer to the next CCB but for now we will only support one console. CCBMBQ points to Console Message Buffers (CMB’s) that are queued to the console. The CMB’s contain the message text to be written to the console. CCBFMQ is a queue of free message buffers for the console. When a message is queued to the console a free buffer is removed from the free buffer queue and added to the message buffer queue. CCBECB is an ECB that will be posted when a message is placed on the message queue. CCBDEV is the device address of the console. CCBQLEN is the total number of message buffers allocated to the console.

@CMB     DSECT ,                  CONSOLE COMMUNICATIONS BUFFER 
CMBNEXT  DS    A                  NEXT BUFFER                   
CMBTEXT  DS    CL79               TEXT                          
CMBFLAG  DS    X                  FLAG

The Console Message Buffer consists of a pointer to the next buffer on the queue. We allow for a message length of 79 bytes.

We define the CCB and CMB’s in module TXXCCB.  We will define the message buffers in this module.

000000                                1 TXXCCB   CSECT ,
                                      2          @CCB  DSECT=N,DEV=010.
000000                                3+CCB010   DS    0F 
000000 00000000                       4+         DC    A(0)
000004 00000000                       5+         DC    A(0)
000008 00000014                       6+         DC    A(@M0101)
00000C 00000000                       7+         DC    F'0'
000010 0010                           8+         DC    XL2'010'
000012 0040                           9+         DC    AL2(64)
                                     10+*
000014 0000006840404040              12+@M0101   DC     A(@M0102),CL79' ',X'00'
000068 000000BC40404040              13+@M0102   DC     A(@M0103),CL79' ',X'00'
                              .
                              .
                              .
00146C 000014C040404040              74+@M01063  DC     A(@M01064),CL79' ',X'00' 
0014C0 0000000040404040              75+@M01064  DC     A(@M01065),CL79' ',X'00'
                            00000    76+@M01065  EQU    0
                                     77          END   ,

Here is the assembly listing for TXXCCB which is the expansion of the @CCB macro.  We define 64 message buffers and they are all placed on the free buffer queue.

[Next – ]