Mainframes 360
The one stop destination for System Z professionals

Sunday, October 10, 2010

Constructing 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, and Input Data-Entry Fields where you can type some input with the keyboard.


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.

There are Five Fields(DFHMDF's) on the INPMAP CICS Screen. To begin with, the First Field is a Display-Only Field, positioned at row 1 and Column 32. The POS Parameter of a field specifies the location of the field on the screen. For the First Field, it is POS=(1,32). The Initial-value that should be stored in this field is  'ADD APPLICATION', so you code INITIAL='ADD APPLICATION'. This text-string is 15 characters in Length including the whitespace, so I must code LENGTH=15. The most important part is specifying the Attributes using ATTRB Parameter.


The ATTRB Parameter has this format – ATTRB=(intensity,protection,extra-stuff). The Intensity of a Field can be NORM(Normal), BRT(Bright) or DRK(Dark). BRT is used for highlighting. DRK is useful in Password Masks. The Protection could be PROT(Protected), UNPROT(Unprotected) or ASKIP(Skipper Fields). PROT is used for Display-only constant Fields, as well as
Output-Fields. This makes the field un-editable. UNPROT is used for
Input Data-Entry Fields, and makes the field User-editable.

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.