CICSintermediate

BMS Maps and Screen Handling

Understand how Basic Mapping Support (BMS) separates screen layout from program logic for 3270 terminal interfaces.

BMS separates what a screen looks like from the program that fills it in. The layout is defined once, assembled, and used by any program.

BMS is like separating a printed form's template (where each blank line and label sits on the page) from the handwriting that fills it in — you can redesign the form's layout entirely without changing a single instruction about what data goes in the 'name' blank versus the 'address' blank.

Key Concepts

1
That separation predates the MVC pattern by decades and is the same idea.
2
A map is defined with macros.
    CUSTMAP  DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL,TIOAPFX=YES
    CUSTM1   DFHMDI SIZE=(24,80)
    CUSTID   DFHMDF POS=(5,20),LENGTH=9,ATTRB=(UNPROT,IC)
    CUSTNAME DFHMDF POS=(7,20),LENGTH=30,ATTRB=(PROT)
             DFHMSD TYPE=FINAL
3
POS is row and column, LENGTH is the field width, and ATTRB says whether the user may type into it, whether it is bright, whether it accepts only digits.
POSLENGTHATTRB
4
Assembling produces two things, and knowing both is the point:
5
    physical map   a load module CICS uses to paint the screen
    symbolic map   a COBOL copybook your program moves data through
6
The copybook generates several subfields per screen field, with suffix letters:
7
    CUSTIDL   PIC S9(4) COMP    length -- how many characters were entered
    CUSTIDA   PIC X            attribute -- set it to change colour or
                                protection at runtime
    CUSTIDI   PIC X(9)         input -- what the user typed
    CUSTIDO   PIC X(9)         output -- what you send
8
So the program never touches screen coordinates. It moves values into CUSTNAMEO and reads CUSTIDI.
CUSTNAMEOCUSTIDI
9
Sending and receiving.
    EXEC CICS SEND MAP('CUSTM1') MAPSET('CUSTMAP') ERASE END-EXEC.
    EXEC CICS RECEIVE MAP('CUSTM1') MAPSET('CUSTMAP') END-EXEC.
10
The detail interviewers ask about: only modified fields come back. A 3270 terminal transmits the fields the user changed, not the whole screen.
11
    user typed into it       CUSTIDL = 9, CUSTIDI holds the value
    user left it alone       CUSTIDL = 0, CUSTIDI is low-values
12
So checking the length subfield before using the value is standard defensive practice. Reading CUSTIDI without checking CUSTIDL gives you low-values and treats "left blank" as a real entry.
CUSTIDICUSTIDL
13
Setting attributes at runtime is how errors are shown: move a bright-red attribute into CUSTIDA and resend the map, and that field is highlighted with the rest of the screen unchanged. That is the standard validation pattern in a BMS application.
CUSTIDA
14
What the interviewer is probing.1. "What is a BMS map?" Probing: the basics. Stalls: "A screen." Moves up: a screen layout defined separately from the program, generating both a physical map for display and a symbolic map the program uses as a data structure.
15
2. "What is the attribute byte for?" Probing: the detail. Stalls: "Colours." Moves up: controlling each field — protected or unprotected, bright or dark, and the modified data tag that decides whether the field is transmitted.
16
3. "What does the modified data tag change?" Probing: the subtle part. Stalls: "Nothing." Moves up: only modified fields are sent back, so a field the user did not touch arrives as low values — reading it as data is a classic bug.
17
4. "How is a map changed without recompiling the program?" Probing: the practical question. Stalls: "You cannot." Moves up: cosmetic changes to the physical map alone can be reassembled, but changing field names or lengths changes the symbolic map and needs a recompile.