Comprehensive Educational information on Computer Programming!: CICS - Interface Block

Saturday, February 23, 2019

CICS - Interface Block

Any application program would require an interface to interact with the CICS. EIB (Execute Interface Block) acts as an interface to allow application programs communicate with the CICS. EIB contains the information required during the execution of a program.

Restricted COBOL Verbs

While coding a CICS program, we cannot use the commands which return the control directly to the MVS. If we code these COBOL verbs, it will not give any compilation error, but we may get unpredictable results. Following are the COBOL verbs which should not be used in a CICS program −
  • File I/O statements like Open, Read, Write, Rewrite, Close, Delete, and Start. All file I/O in CICS is handled by the file control module and they have their own set of statements like READ, WRITE, REWRITE, and DELETE which we will be discussing in the upcoming modules.
  • File Section and Environment Division is not required.
  • COBOL statements that invoke operating system functions like Accept, Date/Time cannot be used.
  • Do not use DISPLAY, MERGE, STOP RUN, and GO BACK.

Execute Interface Block

Execute Interface Block (EIB) is a control block which is loaded automatically by the CICS for every program.
  • The EIB is unique to a task and it exists for the duration of the task. It contains a set of system related information corresponding to the task.
  • It contains information about transaction identifier, time, date, etc., which is used by the CICS during the execution of an application program.
  • Every program that executes as a part of the task has access to the same EIB.
  • The data in EIB at runtime can be viewed by executing the program in CEDF mode.

EIB Fields

The following table provides a list of fields which are present in EIB −
EIB FieldPIC ClauseDescription
EIBAIDX(1)Aid key Pressed
EIBCALENS9(4) COMPIt contains length of DFHCOMMAREA
EIBDATES9(7) COMP-3It contains Current System Date
EIBRCODEX(6)It contains Return code of the last transaction
EIBTASKNS9(7) COMP-3It contains Task number
EIBTIMES9(7) COMP-3It contains Current System Time
EIBTRMIDX(4)Terminal Identifier
EIBTRNIDX(4)Transaction Identifier

CICS Programs Classification

CICS Programs are classified in the following three categories which we will discuss one by one −
  • Non-Conversational Programs
  • Conversational Programs
  • Pseudo-Conversational Programs - We will discuss in the next module

Non Conversational Programs

While executing non-Conversational programs, no human intervention is required. All the necessary inputs are provided when the program is started.
  • They are similar to batch programs that run in the batch mode. So in CICS, they are rarely developed.
  • We can say they are used just for displaying a sequence of screens at regular intervals of time.

Example

The following example shows a non-conversational program which will simply display "HELLO WORLD" on the CICS terminal as output −
IDENTIFICATION DIVISION.                                
PROGRAM-ID. HELLO.                                      
DATA DIVISION.                                          
WORKING-STORAGE SECTION.                                
01 WS-MESSAGE          PIC X(30).                       
PROCEDURE DIVISION.                                     
********************************************************
* SENDING DATA TO SCREEN                               * 
********************************************************
   MOVE 'HELLO WORLD' TO WS-MESSAGE                
   EXEC CICS SEND TEXT                             
      FROM (WS-MESSAGE)                          
   END-EXEC                                        
********************************************************
* TASK TERMINATES WITHOUT ANY INTERACTION FROM THE USER* 
********************************************************
   EXEC CICS RETURN                                
END-EXEC.

Conversational Program

Sending a message to the terminal and receiving a response from the user is called a Conversational. An online application achieves a conversation between the user and the application program by a pair of SEND and RECEIVE command. The key points of a Conversational program are as follows −
  • The system sends a message to the screen and waits for the user’s response.
  • The time taken by user to respond is known as Think Time. This time is considerably high, which is a major drawback of conversion programs.
  • The user provides the necessary input and presses an AID key.
  • The application processes the user’s input and sends the output.
  • The program is loaded into the main storage at the beginning and is retained till the task ends.
CICS Conversion Program

Example

The following example shows a conversion program which takes input from the user and then simply displays the same input on the CICS terminal as output −
IDENTIFICATION DIVISION.                               
PROGRAM-ID. HELLO.                                     
DATA DIVISION.                                         
WORKING-STORAGE SECTION.                               
01 WS-MESSAGE          PIC X(30) VALUE SPACES.         
PROCEDURE DIVISION.                                    
   MOVE 'ENTER MESSAGE' TO WS-MESSAGE           
********************************************************
* SENDING DATA FROM PROGRAM TO SCREEN                  * 
********************************************************
   EXEC CICS SEND TEXT                            
      FROM (WS-MESSAGE)                         
   END-EXEC                                       
********************************************************
* GETTING INPUT FROM USER                              * 
********************************************************
   EXEC CICS RECEIVE                              
      INTO(WS-MESSAGE)                          
   END-EXEC                                       
   EXEC CICS SEND TEXT                            
      FROM (WS-MESSAGE)                         
   END-EXEC                                       
********************************************************
* COMMAND TO TERMINATE THE TRANSACTION                 * 
********************************************************
   EXEC CICS RETURN                               
END-EXEC.                                       

No comments:

Post a Comment