You are on page 1of 8

- CICS communicates with the user interactively through a terminal.

- Whenever a screen image sent to a terminal, the program should store the data it has processed up to that point and end temporarily. When the user enters more data and responds in some other way, the program is restored along with the stored data, and processing continues until the next screen image is sent out by the program. At that point, the data is again stored away and the program temporarily ends again. This process continues, until the program finishes processing the data or the user ends the session. This concept is crucial to CICS programming and is called psuedoconversational programming. - All the application programs are considered as subprograms by CICS. CICS programs must have a linkage section to pass the data to and from. Differences between batch and online.
Batch Online A program starts at the beginning, processes a record, and ends. If there is another record, it will start processig again and end again. If there are 1000 records that need to be processed, the progam will be executing at least 1000 separate times. In fact, online programs will be initiated and terminated many times to accommodate the data validation. Programmer must take special effort to pass data back to CICS to save the data so that it can be returned to the program when the execution resumes. If this coding is not included, the data will be lost. It is possible to code instructions that are executed only once. When a batch program malfunctions, it will just abend. When the program is interrupted, execution bigins not where you left of but the first instruction of your program Most of the files shared concurrently When a online program malfunctions, it can crash entire system

A program starts at the beginning, processes all the data in a file and ends.

The description of the screen coded in the COBOL program is called a symbolic map. Description of the screen coded in the mapset program is called physical map. The physical does have the constants. But the symbolic map does have only variable data but not the constants Differences in using COBOL in batch program and with CICS: In CICS, there are no SELECT/ASSIGN statements, no file description in the data division, and no OPEN and CLOSE statements in the PROCEDURE DIVISION. As a result, the Identification, Environment, and data division looks small compared to batch programs. A CICS program should never execute a STOPRUN or GOBACK. All the CICS programs will be running under a region or partition. The execution of a STOPRUN by a CICS program could be disastrous. When the operating system detects the

execution of STOPRUN, it is not only stops that particular program, but also shuts down the entire partition and then re allocates the space from that partition. Input and Output verbs under CICS. READ DATASET WRITE DATASET REWRITE DATASET DELETE DATASET Some of the restricted commands to CICS. ACCEPT CLOSE DELETE DISPLAY OPEN READ REPORT WRITER REWRITE SORT WRITE START STOPRUN/GOBACK Open/Close The OPEN and CLOSE commands should never be used in CICS program. Typically files are opened when the CICS is up and will be closed when the CICS is down. This is done through CSMT or CEMT transactions Writing the first CICS program: A sample program to send text
IDENTIFICATION DIVISION. PROGRAM-ID. TESTCBL1. AUTHOR. RAVINDRA. DATE-WRITTEN. DECM,2003. DATE-COMPILED. *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* * * * THIS IS TEST PROGRAM * * MAP NAME: NOMAPS * * TRANSACTION: MAP1 * * * * THIS PROGRAM IS USED TO SEND TEXT * * * * *

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* * PROGRAM MODIFICATION LOG * * CHG REF DATE PGMR DESCRIPTION * * 18/12/03 Ravi This is for testing * * * *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. OBJECT-COMPUTER. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-TEXT-AREA LINKAGE SECTION. 01 DFHCOMMAREA

IBM-ES9000. IBM-ES9000.

pic x(08) value 'ABC CORP'. PIC X(1).

PROCEDURE DIVISION. ***************************************************************** 000-MAIN-DRIVER. EXEC CICS SEND TEXT FROM (WS-TEXT-AREA) LENGTH (08) ERASE FREEKB END-EXEC. EXEC CICS RETURN END-EXEC. The SEND TEXT command takes the data stored in a working storage field. You can choose any name, but length should be specified. The ERASE option clears any data that might have appeared previously on the screen. The RETURN command tells the CICS to end the program and return the control to CICS. Under CICS, the first program in any series of programs is started by something called transaction. The other programs in the series also starts with transactions. In other words, series of programs start with single transaction id. Every time a program is executed, a new task is created. RETURN: terminates a task and surrenders all the resources that are used by the program. XCTL: Passes control to another program, but the resources requested by the first program may still be allocated. It is like sell your car LINK: The program control resumes with the instruction following the LINK. It is like loan your car Preserving Working Storage fields:

This is where TRANSID, COMMAREA and LENGTH parameters become important. By specifying these, we save all the fields in working storage. Preserving fields involves coding a working storage field usually a group item. Then, all variables you wish to save are listed as subordinate fields that belongs to the group item. Eg: 01 SAVE-THESE-FIELDS 05 EMP-NAME PIC X(30) 05 EMP-AGE PIC X(2) 05 EMP-ADDRESS PIC X(40) Code eg: EXEC CICS RETURN TRANSID (EBEN) COMMAREA (SAVE-THESE-FIELDS) LENGTH (37) END-EXEC If you want to store 72 bytes of working storage, then DFHCOMMAREA must also be defined as containing 37 bytes. Eg: LINKAGE SECTION. 01 DFHCOMMAREA

PIC X(72)

Length parameter should always be defined as S9(04) The EIBCALEN field: EIBCALEN is an automatically defined field that is inserted into your program by the CICS translator during the translation or compilation process. This field can used to detect whether a program is running for the first time during a session is by interrogating the predefined EIBCALEN field. EIB stands for Execution Interface Block. CA stands for Communication Area, LEN stands for length. Multithreading and Quasi-Reentrant Programs: Multithreading means, many users are concurrently reusing the same program. The technique for keeping the data separately while reusing the same program is called quasi reentrant. 3. Basic mapping Support Sending maps: If you execute a SEND MAP/MAPONLY to a blank screen, only the physical map is sent to terminal. With map only option, only the hard coded values in the physical map will be displayed on the screen. SEND MAP/DATAONLY to a blank screen, then only the variables in the working storage section will be sent. In other words, it just sends the variables in the symbolic map. But not the constants from physical map. SENDMAP to a blank screen without specifying either the MAPONLY or DATAONLY option, then all the information from the physical map and all the information from the symbolic map will be sent to the screen.

Commonly used attributes for fields: ATTRB=(BRT,DRK,NORM,IC,NUM,FSET,PROT,UNPROT,ASKIP) While POS and LENGTH parameters provide a quantitative description of a field, the attribute byte provides a qualitative description. NUM: This field is right justified and padded with leading ZEROES. This doesnt guarantee that the data is numeric. FSET: This is an important attribute. To reduce the transmission of unnecessary data, CICS will not transmit unchanged fields. Protected Fields: A field is protected from the user. But not necessarily from the programs. Unprotected fields: This specifies that the field is unprotected. In order to do this 1. Code UNPROT for the field involved and 2. Special one byte field to tell BMS where the unprotected field ends. Stopper and Auto skip fields: Autoskip (ASKIP)will automatically position the cursor at the beginning of next unprotected field. Other Parameters: PICIN and PICOUT: These options can be used to specify character editing strings. Extended Attributes: There are two categories of extended attributes. 1. Color 2. Highlighting DFHBMSCA contains special attribute characters for extended and non extended attribute terminals.

4. Writing a program using Maps

Steps to write and test the Program 1. Design the screen layout on the paper. It helps you to visualize what the screen look like. It helps you in creating the physical map. 2. Write a Brief narrative This should contain, What will appear on the screen, What should the user enters, what must be done to end the session, What will happen if there is an error. 3. Code the map set Program 4. Compile the mapset program 5. Design and code sample COBOL Program To send a map to a terminal, use the CICS SEND MAP command. To end the program, use the CICS RETURN command. 6. Compile the COBOL Program Compile the COBOL program using special JCL procedure for your installation. This is different from your Batch program compile. 7. Switch over to CICS and sign on

After the mapset program and the COBOL program are translated, compiled, and linked in batch, switch over to the CICS partition, update the PPT, and then execute the CICS program. 8. Update the PPT for the Mapset program. To update the PPT for the mapset program, type the following: CSMT NEW,PGRMID=name of your program If the mapset program is called as ABCDMS1, then type CSMT NEW,PGRMID=ABCDMS1 Like wise equivalent command CEMT SET PROGRAM (ABCDMS1) NEWCOPY 9. Update the PPT for COBOL program Name of the COBOL program, ABCDPG1 CSMT NEW,PGRMID=ABCDPG1 CEMT SET PGRMID (ABCDPG1) NEWCOPY 10. Clear the screen and run the CICS program To run a test, clear the screen then enter the four-byte transaction ID associated with your program. This will be given to you by the instructor or the system programmer. 11.Leave CICS Clear the screen and sign off using the CSSF command. Some common errors: TRANSACTION INVALID IDENTIFICATION: Clear the screen and reenter the correct transaction ID. CICS abends: CICS has its own kind of abend codes, these are different from the batch abend codes.

5. Commonly used CICS Tables and Commands


1. CICS Tables:
CICS need several tables to keep track of its resources. These tables are usually created and maintained by the system programmers. There are several tables needed by CICS. But an application programmer must be aware of at least following FOUR. 1. Sign on tables (SNT) It contains the names and passwords of the authorized users. It is created and usually maintained by the system programmer. 2. Program Control table (PCT) This table contains each transaction and contains a list of valid fourbyte transaction IDs. The transaction IDs are connected to CICS program. A program is started by entering a four-byte transaction id. Once the program is started executing, that program may execute another related program without requiring that another transaction ID typed in. Whenever you are developing a new program, you have to inform the system programmer, so that she can create additional entries for the transaction ids and associated programs. 3. Processing Program Table (PPT) This program keeps the list of CICS application program and mapsets. 4. File Control table (FCT)

This table keeps track of all the file name and their characteristics. Other than these there are many other tables like System Initialization Tables (SIT) Terminal Control table (TCT) Journal Control Table (JCT) Destination Control Table (DCT) Temporary Storage Table (TST) Monitoring Control Table (MCT) Application Load Table (ALT) System Recovery Table (SRT) Program List Table (PLT) Transaction List Table (XLT) Terminal List Table (TLT) Ten Commonly Used CICS commands: 1. SEND MAP Command: SEND: This means your program will transmit the data to a terminal. MAP: Name of the individual map within the assembler mapset program. This could be a literal string or a variable name. If it is literal string, it should be enclosed in quotes. MAPSET: This is the name of the Assembler mapset that appears on the same line as the DFHMSD of the map set. FROM: Unlike the map and mapset name, this variable is not code in quotes. MAPONLY: This option is used when you wish to send only constants to screen DATAONLY: This option is used when you wish to send only a symbolic map to a terminal. If neither MAPONLY and DATAONLY is specified, then both the physical and symbolic maps are sent. ERASE: This option will clear the screen before a new map is sent to the screen. ERASEAUP: This option is actually an acronym for ERASE ALL UNPROTECTED FIELDS. This will not erase constants or any other variable fields, that have protected attributes. CURSOR: This is an option that is used frequently. The combination of moving the reserved value -1 to the LENGTH of a field on the COBOL symbolic map with the coding of the CURSOR option on the SEND command will place the CURSOR on the unprotected field of your choice. 2. The RECEIVE command RECEIVE:

This command will receive the data from a terminal and insert the data into a symbolic map. MAP: Same meaning as the previous command. MAPSET: Same meaning as in the previous command. INTO: This option indicates the name of a COBOL symbolic map that will receive the data from a terminal. This is a COBOL name and may contain the hyphens and be up to 30 bytes long. Eg: EXEC CICS RECEIVE MAP (MAPABC) MAPSET (ABCDMS1) INTO (MY-COBOL-MAP-NAME) END-EXEC

You might also like