Mainframes 360
The one stop destination for System Z professionals

Sunday, October 10, 2010

Introduction to CICS GUI Screens

Q. What is a CICS Map?
A CICS Map is a GUI Screen, just like an Internet Web-page. It can have a Title Header, Display-Only Constant Fields which prompt you what information to type, Input Data-Entry Fields where you can type some input with the keyboard, and Output-Fields where the result of processing may be displayed.


Have you come across an application-form, that you’ve got to fill when you take a Competitive Entrance test like the CAT, or GMAT? The Application-Form has a Title like 'SAMPLE APPLICATION FORM'. It has Display-Only Constant Fields like the 'Name of the Applicant', 'Date-of-Birth','Residential-Address' etc. Display-Only Constant Fields are used for Messages and Captions, and this data cannot be changed by the user. These fields prompt you, about what information is needed. Each of these are followed by Input Data-Entry Fields '_____'(the blank lines), where you are supposed to type the data asked. This is the anatomy of CICS GUI Screen or CICS Map.
Q. What is BMS(Basic Mapping Support)?
Writing a CICS Map, is just like designing a Web-Page in HTML. CICS Maps are coded using BMS Instructions. BMS stands for Basic Mapping Support. The three important BMS Instructions are DFHMSD, DFHMDI and DFHMDF.

The DFHMSD instruction is used to define a New Mapset. A Mapset is a list or collection of Maps. You put related Maps or CICS GUI Screens together into
1 Mapset. Generally, when you have a big system, with hundreds of CICS Screens, you group all the screens related to same functionality under one common Umbrella, under one Mapset. A Mapset is a means to gift-wrap many CICS Pages together.

The DFHMDI Instruction is used to define a New Map(within a Mapset). A Map represents a single CICS GUI Screen. You code the DFHMDI Instruction to tell, what is the size or dimensions of the CICS Page, just like your PC-Screen has a resolution of 1024x768. The DFHMDI Instruction of the Map, also tells what’s the line the Cursor should be initially positioned, when the Screen is displayed.

Every CICS GUI Screen has many Fields – Title field, constant-fields, data-entry Fields. To create a New Field on a Map, you code the DFHMDF Instruction. The DFHMDF Instruction defines the placement of the Field(where does it appear on the Screen), is it a Display-Only constant-field or a Data-Entry Field, what is the Length of the Field, does it have an initial-value and much more.
Q. What is the general format of a BMS Instruction?
Before you begin to write BMS Code, take a look at how a BMS Instruction looks like -


Every BMS Instruction can have a unique-name or Label. The name or Label assigned to a BMS Instruction begins at Column 1. I've coded the name APPFORM(Application Form) for my Mapset. This is followed by the BMS-Operation, like DFHMSD for a new mapset, or DFHMDI for a new Map in the Mapset, or DFHMDF for a new Field on the Map. Every BMS Instruction is followed by one or more Parameters. For example, DFHMSD(Mapset Definition) takes the parameters TYPE, MODE, LANG, TIOAPFX and CNTL. These parameters should always be coded on Column 16. Moreover, if a BMS Instruction doesn’t fit into one line, but spans into subsequent lines, you should code Continuation-Character 'X' on the Column 72. The Parameter-List is always separated by Comma's.
Q. Demonstrate to me, how to code a few CICS GUI Screens?
We'll start off by writing the code and designing a simple 2-Screen Toy-Application. I have created a separate Mainframe PDS or LibrarySYSADM.DEMO.MAPLIB, for storing the code for all the Maps, that I use in different Applications. Here’s my Personal Map-Library.


I am going to code an Add-Application, which will have two screens. The Input-Screen accepts two-numbers from the User. The Output-Screen displays sum of the two numbers. The Input-Screen and the Output-Screen, are the two screens under the Add Application, so I will group them under one Mapset – ADDAPP. I have created a Member ADDAPP, under the Library SYSADM.DEMO.MAPLIB, to store the BMS Code for CICS Input-Output Screens belonging to Add-Application.

Let's begin by coding the Mapset Definition Instruction – DFHMSD. I am creating a New Mapset, by the name ADDAPP. The ADDAPP takes several Parameters, such as TYPE, INOUT, STORAGE etc.


The TYPE Parameter can be assigned a value MAP, DSECT or &SYSPARM. Read about the TYPE Parameter at length, when you know what's a Symbolic-Map and
Physical-Map. LANG=COBOL is important, it means the screen's data will be processed by a Program written in COBOL. You may even have a PL/I, or an Assembler Program that processes the data on CICS-Screens. You would then end up writing LANG=PLI or LANG=ASM.

The MODE specifies, whether the Map is used for Input(IN), or Output(OUT), or both(INOUT). CTRL specifies a List of Control-Options, for each Screen. Like I have coded CTRL=FREEKB. Generally, when a new CICS Screen is displayed on the Terminal, the Keyboard goes into a Locked State(you can’t key in any Input). You need to reset(unlock) the Keyboard, by pressing the Escape-Key. To avoid this, you can code CTRL=FREEKB, which will always free the Keyboard, before the Screen is Displayed.

The MAPATTS and DSATTS tell, that the CICS GUI Screens will support some extended attributes(characteristics) such as Color.

What's next? Here is a road-map of what’s going to come? Under the ADDAPP Mapset(DFHMSD), I am going to create two Screens(Maps), called INPMAP-Input-Screen for accepting two numbers(DFHMDI) and OUTMAP-Output-Screen for displaying Output(DFHMDI). Under each Map(DFHMDI), there will fields(DFHMDF's). The below picture is general skeleton of how the Entire ADDAPP Mapset broken down into 2 Screens – INPMAP and OUTMAP will be coded.


Let's take one Map at a time. First the Input-Screen INPMAP. I want the Screen to be of a Size 24 Rows x 80 Columns. To specify the Size, you code the SIZE Parameter as SIZE=(24,80). The LINE Parameter and COLUMN Parameter specify the co-ordinates where the CICS Screen starts. For now, you would code LINE=1, and COLUMN=1, till you start working with Multi-Panel Maps(just like an Internet Website has Frames). This is how the DFHMDF Macro Instruction for INPMAP Looks like -


Shown below is a Wire-Frame Layout of the INPMAP Input Screen, how it should look and the various Fields on it. To aid your understanding, I’ve highlighted the various Fields on the Map. This CICS-Map has Display-Only Constant-Fields : the ones in grey, the ones in Yellow are Input Data-Entry Fields. Display-Only Fields are always fixed, they cannot be changed, you can’t modify them, or type something there. On Input Data-Entry Fields, the User can type Input, using the Keyboard.

Q. How to code DISPLAY-Only Constant Fields on the CICS-Screen?
The Fields whose Data-Value always remains Fixed or Constant, are called Display-Only Fields. The User cannot Over-type, modify the data of this Field. These Fields restrict User-Input. The Data in the Field is Protected(PROT).

To begin with, the 'ADD APPLICATION' Title is a Display-Only Field, positioned right at the center - row 1 and Column 32.

Like-wise, 'FIRST NUMBER  : ' is a Display-Only Protected(PROT) Field, positioned at Row 5 and Column 03. Look, how I've coded the DFHMDF for the this field. 


As an exercise, try coding the 'SECOND NUMBER : ' which sits directly  below(underneath) the 'FIRST NUMBER : ' Field on Line 7 and Column 03, by yourself. This is how I coded the 'SECOND NUMBER : ' Display-Only Field.

Q. How to code Input Data-Entry Fields on CICS Screen?
An Input Data-Entry Field, is an Area - where the User is expected to type some data-value and supply Input. The Data in this field is keyed-in by the User. Hence, the User is free to type any Input he desires in these fields. Data-Entry Fields are therefore, said to be un-protected(UNPROT).

When you run COBOL-Programs in Batch-Mode, by writing a Job, the Input-Data to these Programs is generally stored  in Mainframe-Files(Datasets). What about COBOL Programs run in Online-Interactive Mode ; have you wondered, what’s their source of the Input-Data? Bingo! Data-Entry Fields are the Primary-Source of Feeding Input-Data to the COBOL-Programs run in Online Mode under CICS. It should clear, that COBOL-Programs run in Online-Mode under CICS, read the Data from Input Data-entry Fields, process the Data, and generate Output

Since COBOL Programs need to access and read the Data from Input-Fields, it is important that you assign a name or Label to your Input-Fields on the CICS Screen. The Input-Screen INPMAP has Input-Fields containing two empty Blanks '__' adjacent to 'FIRST NUMBER : ' and 'SECOND NUMBER : ' Display-Fields. I have named them NUMBER1 and NUMBER2.

How to calculate the Position or Placement of Consecutive-Fields? You employ a simple formula (start  + Length + 1 ). For example, 'FIRST NUMBER : '
display-only field starts at column 3, and is 15 bytes long. So, the '__' Input-Field next to it can start on or after (03 + 15 + 1) = Column 19. You shouldn’t be surprised, as to why I've positioned NUMBER1 and NUMBER2 Fields at (5,19) and (7,19) respectively.
Q. How to code Output-Result Fields on a CICS Screen?
Shown below is the Wire-Frame Model of the Output-Screen OUTMAP. It has an Output-Field colored in Green, used to display the Sum of the Two Input-Numbers.

Output-Fields on a CICS Screen, are used for displaying Outputs, results of processing, Messages or Warnings. The COBOL-Program running in Online-Mode, after having processed the Data, stores or populates the Output in these Fields. 

The Output-Field value is populated by the COBOL-Program,(and not the user) caution – the user should not be able to type any Input Here! To keep the users away from Output-Fields, you should lock and Protect them from User-being modified. Set the Field to be Protected(PROT).

As the COBOL-Program accesses this Destination-Field to store the Final-Output, the Field must have a meaningful name or Tag(like Tommy, Rocky, just kidding!), by which the COBOL-Program can refer to it. I’d like to call my Output-Field by the name RESULT.

Here’s the BMS Code for the Output-Screen OUTMAP. Should be easy now.


To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.