Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

COBOL  Module 14 – CICS online programs (concepts with local business-logic tests)

CICS commands, BMS maps and error handling

Read the EXEC CICS commands and BMS maps of an update transaction, test every outcome with RESP, and prove its error paths with stubs under GnuCOBOL.

  • Advanced
  • 25 minutes
  • Examples run with GnuCOBOL 3.2, Python 3.14.8 and Pyodide 314.0.7
  • By MySmartCoPilot
Free core, Pro depth: 9 of 25 minutes free
Free: Six CICS commands do most of an online program's work · BMS maps describe the screen, and the program fills their fields · RESP returns every outcome to the program, and a stub can return any of them · Practise: commands, maps and responses. With a pass: 3 in-depth parts and 3 interview answers, about 16 minutes.

What you will learn

  • Read EXEC CICS SEND MAP, RECEIVE MAP, READ, REWRITE, LINK and XCTL commands and say what each returns
  • Handle every command's outcome with RESP and RESP2 instead of HANDLE CONDITION
  • Test the error paths of a CICS program without CICS by putting each command in a paragraph a stub can replace
  • Explain units of work, SYNCPOINT and abend handling in a CICS update
  • Describe how a CICS program and its BMS maps are translated, built and defined

Before you start

What you’ll learn · Before you start

What you will learn

  • Read EXEC CICS SEND MAP, RECEIVE MAP, READ, REWRITE, LINK and XCTL commands and say what each returns
  • Handle every command's outcome with RESP and RESP2 instead of HANDLE CONDITION
  • Test the error paths of a CICS program without CICS by putting each command in a paragraph a stub can replace
  • Explain units of work, SYNCPOINT and abend handling in a CICS update
  • Describe how a CICS program and its BMS maps are translated, built and defined

Before you start

On this page

A READ of the account file can end NORMAL or with one of 16 conditions, such as NOTFND, NOTOPEN and IOERR, and for 15 of them IBM’s default is to end the task abnormally. A program that changes one customer’s record issues five commands in a task, so most of what it decides is what to do when a command does not end normally.

This lesson reads the CICS commands of AUPD, a transaction that changes a customer’s mobile number, and the BMS maps behind its screen. Its error handling then runs on this computer: each command sits in a paragraph of its own, and a test build swaps those paragraphs for stubs that answer as CICS would.

Six CICS commands do most of an online program’s work

Task 2 of AUPD uses four of the commands below; the other two move control between programs. Each command names its resources in parentheses and ends in NORMAL or a condition:

Command What it does A condition to plan for
RECEIVE MAP maps the terminal’s input into the input map MAPFAIL: nothing to map
SEND MAP writes the output map to the screen INVREQ: an option misused
READ with UPDATE reads a record and holds it for a change NOTFND: no record with this key
REWRITE replaces the held record DUPREC: a unique key exists; INVREQ: nothing held
LINK runs a program one logical level down PGMIDERR: no such program
XCTL passes control at the same level, for good PGMIDERR

IBM’s reference says a REWRITE must always follow a READ with UPDATE. LINK and XCTL differ in one thing: when the program that LINK called ends, control returns to the statement after the LINK, while XCTL releases the program that issued it, so control never comes back. Step through one successful change:

Interactive · message by message The commands of one change of a mobile number Step through task 2 of AUPD. Each message is one EXEC CICS command and the outcome CICS returns for it.
The commands of one change of a mobile number, step 6 of 6. Messages so far: 3270 terminal to AUPD: Enter, 5550002000; AUPD to ACCOUNTS file: READ ... UPDATE; ACCOUNTS file to AUPD: NORMAL, version 7; AUPD to ACCOUNTS file: REWRITE; AUPD to 3270 terminal: Mobile number changed.3270 terminalnew mobile typedAUPDversion 7 = 7ACCOUNTS file5550002000, version 8Enter, 5550002000READ ... UPDATENORMAL, version 7REWRITEMobile number changed

The drawing shows the whole scene; its 6 steps are listed below.

Every step as text
  1. The teller presses Enter. The teller has typed 5550002000 as the new mobile number of AC00000042 and pressed Enter. CICS starts task 2 of AUPD with the COMMAREA of task 1, the account and version 7.
  2. RECEIVE MAP. RECEIVE MAP moves the typed number from the terminal's input into the input map, AUPDMAPI. RESP is 0, NORMAL, so NEWMOBI holds the ten digits.
  3. READ with UPDATE. READ FILE('ACCOUNTS') with UPDATE reads the record of AC00000042 and holds it, so no other task can change it until this unit of work ends.
  4. The version matches. The record still has version 7, the version task 1 showed the teller, so nobody changed it in between. AUPD moves in the new number and adds 1 to the version.
  5. REWRITE. REWRITE replaces the held record. RESP 0 means no other account has 5550002000, which the file's unique index on the mobile number would have refused with DUPREC.
  6. SEND MAP and RETURN. AUPD sends "Mobile number changed" with SEND MAP and ends its task with RETURN TRANSID('AUPD'). The end of the task commits the change and releases the record.

Beyond the scene’s commands, four more names matter:

  • SYNCPOINT commits a task’s changes so far; SYNCPOINT ROLLBACK backs them out.
  • ABEND ends a task abnormally; HANDLE ABEND names an exit for that case.
  • The CICS translator turns each EXEC CICS command into a CALL at compile time.
  • CEMT SET PROGRAM NEWCOPY or PHASEIN loads a rebuilt program.

Checkpoint

Check: The commands of an online program

  1. One question The first program of a transaction, ACCTMENU, passes control to AUPD with XCTL. When AUPD later issues RETURN, where does control go?
    Show the answer: One question

    Answer: Not to ACCTMENU, which XCTL released, but to the level above it, which here is CICS

    LINK returns to its caller; XCTL never does. A menu that must regain control uses LINK, and one that hands over for good uses XCTL.

BMS maps describe the screen, and the program fills their fields

The screen of AUPD is defined once, as BMS map: A screen layout for CICS basic mapping support, defined with the DFHMDI and DFHMDF macros inside a map set. BMS uses it to build a 3270 screen from a program's data and to move the input back into named fields.: a map set: The unit in which BMS maps are defined and assembled, with the DFHMSD macro. Assembled twice, it gives a physical map, kept in the CICS load library for BMS, and a symbolic map that programs copy. (DFHMSD) holds maps (DFHMDI), and each map lists its fields (DFHMDF) with a position, a length and attributes such as protected or numeric. Assembled twice, the source gives a physical map that BMS uses to build the screen and a symbolic map: The COBOL data definition made from a map set, which a CICS program copies. For each named field it holds a length, suffix L, an attribute, suffix A, and the data, inside an input map ending in I and an output map ending in O. that the program copies:

UPDSET.bms: the map set of AUPD (concept listing, not assembled here) BMS · UPDSET.bms
* Concept listing, not assembled here: map set UPDSET with the
* screen of transaction AUPD. Assembled twice, with SYSPARM=MAP
* for the physical map and SYSPARM=DSECT for the symbolic map.
UPDSET   DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL2,                  X
               STORAGE=AUTO,TIOAPFX=YES,CTRL=(FREEKB,FRSET)
AUPDMAP  DFHMDI SIZE=(24,80),LINE=1,COLUMN=1
         DFHMDF POS=(1,1),LENGTH=30,ATTRB=(ASKIP,BRT),                 X
               INITIAL='AUPD  Change the mobile number'
         DFHMDF POS=(3,1),LENGTH=8,ATTRB=ASKIP,INITIAL='Account:'
ACCT     DFHMDF POS=(3,10),LENGTH=10,ATTRB=ASKIP
         DFHMDF POS=(4,1),LENGTH=8,ATTRB=ASKIP,INITIAL='Current:'
OLDMOB   DFHMDF POS=(4,10),LENGTH=10,ATTRB=ASKIP
         DFHMDF POS=(6,1),LENGTH=11,ATTRB=ASKIP,INITIAL='New mobile:'
NEWMOB   DFHMDF POS=(6,13),LENGTH=10,ATTRB=(UNPROT,NUM,IC)
         DFHMDF POS=(6,24),LENGTH=1,ATTRB=ASKIP
MSG      DFHMDF POS=(22,1),LENGTH=40,ATTRB=(ASKIP,BRT)
         DFHMDF POS=(24,1),LENGTH=24,ATTRB=ASKIP,                      X
               INITIAL='Enter: change   PF3: end'
         DFHMSD TYPE=FINAL
         END

In the symbolic map each named field becomes four names, shown here for NEWMOB:

Name in the symbolic map What it holds
NEWMOBL how many characters the teller typed, 0 for none
NEWMOBA the attribute byte, changed to show the field differently
NEWMOBI the typed text, in the input map AUPDMAPI
NEWMOBO the text to send, in the output map AUPDMAPO

RECEIVE MAP moves the terminal’s input into the input map. When the teller presses CLEAR or a PA key, or Enter without typing, there is nothing to map: the command returns MAPFAIL, which ends the task unless the program handles it.

Checkpoint

Check: BMS maps, symbolic and physical

  1. One question On the AUPD screen the teller presses CLEAR. AUPD's RECEIVE MAP codes RESP. What does it return?

    Choose one answer.

    Show the answer: One question

    Answer: MAPFAIL, because there is no data to map

    A program that receives a map must decide what MAPFAIL means for it, for example sending the screen again. IBM's default for MAPFAIL, without RESP, is to end the task abnormally.

RESP returns every outcome to the program, and a stub can return any of them

Without RESP, a condition goes to CICS’s default handling. The older HANDLE CONDITION: An older CICS command that sends named conditions, such as NOTFND, to labels for the rest of the program, until a later HANDLE CONDITION or IGNORE CONDITION changes it or a command codes RESP or NOHANDLE. command sends a condition to a label, and IBM’s reference says it applies to the whole program, so a NOTFND of any later command lands on the same label. The RESP option: An option of an EXEC CICS command that returns the command's outcome in a fullword binary field instead of letting CICS handle a condition. The program compares it with values such as DFHRESP(NORMAL) and must handle every outcome itself. instead puts the outcome in a fullword binary field, which the program compares with DFHRESP(NORMAL) or DFHRESP(NOTFND) on the next line; RESP2 says why, 80 for NOTFND on a READ. IBM states the price: with RESP the program must cope with whatever condition arises.

That makes error handling code like any other, and code can be tested. AUPD keeps every CICS command in a paragraph of the copybook AUPDIO. A CICS build copies cics/AUPDIO.cpy; a test build copies stubs/AUPDIO.cpy, whose stub: A stand-in, written for tests, for a part that a program calls. It answers as the real part would, for example a paragraph that returns the RESP and RESP2 values of a CICS command on a computer without CICS. call FAKECICS, a program that answers each command with the RESP and RESP2 values of IBM’s reference and prints them. The first case is an account number that is not on file:

AUPD.cob: task 2 of AUPD, with its CICS paragraphs copied at the end COB · AUPD.cob
       IDENTIFICATION DIVISION.
       PROGRAM-ID. AUPD.
      * The second task of transaction AUPD: change the registered
      * mobile number of an account. Task 1 read the account, showed
      * its number and passed the account and its version in the
      * COMMAREA. Every command that needs CICS is in a paragraph of
      * AUPDIO, copied at the end: cics/AUPDIO.cpy in a CICS build,
      * stubs/AUPDIO.cpy in a test build without CICS.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-COMMAREA.
           05  CA-ACCOUNT           PIC X(10).
           05  CA-VERSION           PIC 9(8).
       01  WS-NEW-MOBILE            PIC X(10).
       01  WS-MESSAGE               PIC X(40).
       01  WS-RESP                  PIC S9(8) COMP.
       01  WS-RESP2                 PIC S9(8) COMP.
       01  SHOWN-RESP               PIC Z(7)9.
       01  SHOWN-RESP2              PIC Z(7)9.
       01  WS-OUTCOME               PIC X.
           88  OUTCOME-NORMAL           VALUE "N".
           88  OUTCOME-NOT-FOUND        VALUE "F".
           88  OUTCOME-DUPLICATE        VALUE "D".
           88  OUTCOME-FAILED           VALUE "X".
       COPY ACCTREC.
       COPY AUPDWS.
       LINKAGE SECTION.
      * The COMMAREA that task 1 passed, 18 bytes: the CICS
      * paragraphs read it only when EIBCALEN is not 0.
       01  DFHCOMMAREA              PIC X(18).
       PROCEDURE DIVISION.
       MAIN-PARA.
           PERFORM GET-INPUT
           EVALUATE TRUE
               WHEN NOT OUTCOME-NORMAL
                   MOVE "Start again with AUPD" TO WS-MESSAGE
               WHEN WS-NEW-MOBILE IS NOT NUMERIC
                   MOVE "Type 10 digits" TO WS-MESSAGE
               WHEN OTHER
                   PERFORM CHANGE-MOBILE
           END-EVALUATE
           PERFORM SEND-REPLY
           GOBACK.
       CHANGE-MOBILE.
           PERFORM READ-FOR-UPDATE
           EVALUATE TRUE
               WHEN OUTCOME-NOT-FOUND
                   MOVE "No account with this number" TO WS-MESSAGE
               WHEN NOT OUTCOME-NORMAL
                   PERFORM REPORT-FAILURE
               WHEN ACCT-VERSION NOT = CA-VERSION
                   PERFORM UNLOCK-ACCOUNT
                   MOVE "Changed by someone else: check again"
                       TO WS-MESSAGE
               WHEN OTHER
                   MOVE WS-NEW-MOBILE TO ACCT-MOBILE
                   ADD 1 TO ACCT-VERSION
                   PERFORM REWRITE-ACCOUNT
                   EVALUATE TRUE
                       WHEN OUTCOME-NORMAL
                           MOVE "Mobile number changed" TO WS-MESSAGE
                       WHEN OUTCOME-DUPLICATE
                           MOVE "Number belongs to another account"
                               TO WS-MESSAGE
                       WHEN OTHER
                           PERFORM REPORT-FAILURE
                   END-EVALUATE
           END-EVALUATE.
       REPORT-FAILURE.
           MOVE WS-RESP TO SHOWN-RESP
           MOVE WS-RESP2 TO SHOWN-RESP2
           MOVE SPACES TO WS-MESSAGE
           STRING "Not changed: RESP " DELIMITED BY SIZE
                  FUNCTION TRIM(SHOWN-RESP) DELIMITED BY SIZE
                  ", RESP2 " DELIMITED BY SIZE
                  FUNCTION TRIM(SHOWN-RESP2) DELIMITED BY SIZE
                  INTO WS-MESSAGE
           END-STRING.
       COPY AUPDIO.
cics/AUPDIO.cpy: the paragraphs for CICS (concept listing, not run) CPY · cics/AUPDIO.cpy
      * Concept listing, not run: the paragraphs of AUPD that use
      * CICS, for a build with the CICS translator. Every command
      * codes RESP and RESP2, so CICS returns its outcome instead
      * of ending the task, and NAME-THE-OUTCOME names it.
       GET-INPUT.
           IF EIBCALEN = 0
               SET OUTCOME-FAILED TO TRUE
           ELSE
               MOVE DFHCOMMAREA TO WS-COMMAREA
               EXEC CICS RECEIVE MAP('AUPDMAP') MAPSET('UPDSET')
                   INTO(AUPDMAPI) RESP(WS-RESP) RESP2(WS-RESP2)
               END-EXEC
               PERFORM NAME-THE-OUTCOME
               MOVE NEWMOBI TO WS-NEW-MOBILE
           END-IF.
       READ-FOR-UPDATE.
           EXEC CICS READ FILE('ACCOUNTS') INTO(ACCT-RECORD)
               RIDFLD(CA-ACCOUNT) UPDATE
               RESP(WS-RESP) RESP2(WS-RESP2)
           END-EXEC
           PERFORM NAME-THE-OUTCOME.
       REWRITE-ACCOUNT.
           EXEC CICS REWRITE FILE('ACCOUNTS') FROM(ACCT-RECORD)
               RESP(WS-RESP) RESP2(WS-RESP2)
           END-EXEC
           PERFORM NAME-THE-OUTCOME.
       UNLOCK-ACCOUNT.
           EXEC CICS UNLOCK FILE('ACCOUNTS')
               RESP(WS-RESP) RESP2(WS-RESP2)
           END-EXEC
           PERFORM NAME-THE-OUTCOME.
       SEND-REPLY.
           MOVE WS-MESSAGE TO MSGO
           EXEC CICS SEND MAP('AUPDMAP') MAPSET('UPDSET')
               FROM(AUPDMAPO) DATAONLY
           END-EXEC
           EXEC CICS RETURN TRANSID('AUPD')
               COMMAREA(WS-COMMAREA)
           END-EXEC.
       NAME-THE-OUTCOME.
           EVALUATE WS-RESP
               WHEN DFHRESP(NORMAL)
                   SET OUTCOME-NORMAL TO TRUE
               WHEN DFHRESP(NOTFND)
                   SET OUTCOME-NOT-FOUND TO TRUE
               WHEN DFHRESP(DUPREC)
                   SET OUTCOME-DUPLICATE TO TRUE
               WHEN OTHER
                   SET OUTCOME-FAILED TO TRUE
           END-EVALUATE.
stubs/AUPDIO.cpy: the same paragraphs for a test build CPY · stubs/AUPDIO.cpy
      * The same paragraphs for a build without CICS: each calls
      * FAKECICS, which answers as the command would, with the RESP
      * and RESP2 values of IBM's documentation, and NAME-THE-OUTCOME
      * names them as the CICS build does: 0 NORMAL, 13 NOTFND,
      * 14 DUPREC, anything else a failure.
       GET-INPUT.
           MOVE "INPUT" TO FK-OP
           CALL "FAKECICS" USING FAKE-PARM
           MOVE FK-COMMAREA TO WS-COMMAREA
           MOVE FK-TYPED TO WS-NEW-MOBILE
           PERFORM NAME-THE-OUTCOME.
       READ-FOR-UPDATE.
           MOVE "READUPD" TO FK-OP
           MOVE CA-ACCOUNT TO FK-ACCOUNT
           CALL "FAKECICS" USING FAKE-PARM
           IF FK-RESP = 0
               MOVE FK-RECORD TO ACCT-RECORD
           END-IF
           PERFORM NAME-THE-OUTCOME.
       REWRITE-ACCOUNT.
           MOVE "REWRITE" TO FK-OP
           MOVE ACCT-RECORD TO FK-RECORD
           CALL "FAKECICS" USING FAKE-PARM
           PERFORM NAME-THE-OUTCOME.
       UNLOCK-ACCOUNT.
           MOVE "UNLOCK" TO FK-OP
           CALL "FAKECICS" USING FAKE-PARM
           PERFORM NAME-THE-OUTCOME.
       SEND-REPLY.
           MOVE "REPLY" TO FK-OP
           MOVE WS-MESSAGE TO FK-MESSAGE
           CALL "FAKECICS" USING FAKE-PARM.
       NAME-THE-OUTCOME.
           MOVE FK-RESP TO WS-RESP
           MOVE FK-RESP2 TO WS-RESP2
           EVALUATE WS-RESP
               WHEN 0
                   SET OUTCOME-NORMAL TO TRUE
               WHEN 13
                   SET OUTCOME-NOT-FOUND TO TRUE
               WHEN 14
                   SET OUTCOME-DUPLICATE TO TRUE
               WHEN OTHER
                   SET OUTCOME-FAILED TO TRUE
           END-EVALUATE.
AUPD built with stubs, on an account that is not on file Python · notfound_session.py
from session import files, run

# AUPD built with the stub paragraphs of stubs/ instead of CICS, and its test driver run on one case: an account
# number that is not on file. FAKECICS prints each command it answers.
files("AUPD.cob", "ACCTREC.cpy", "FAKECICS.cob", "FAKEPARM.cpy", "AUPDTEST.cob", "aupd-case-1.txt",
      "stubs/AUPDIO.cpy", "stubs/AUPDWS.cpy")
run("""
cobc -x -Wall -I stubs AUPDTEST.cob AUPD.cob FAKECICS.cob && DD_AUPDCASES=aupd-case-1.txt ./AUPDTEST
""")

Output

$ cobc -x -Wall -I stubs AUPDTEST.cob AUPD.cob FAKECICS.cob && DD_AUPDCASES=aupd-case-1.txt ./AUPDTEST
case 01: AC00009999 version 00000001, typed 5550002000
  READ UPDATE AC00009999: RESP 13, RESP2 80
  SEND MAP: No account with this number
pass
ALL 01 TESTS PASSED

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 notfound_session.py

FAKECICS answered the READ with RESP 13 and RESP2 80, NOTFND, and AUPD sent “No account with this number” without a REWRITE: an error path of a CICS program ran on a laptop in seconds.

Checkpoint

Check: RESP, HANDLE CONDITION and stubs

  1. One question A program issues HANDLE CONDITION NOTFND(NO-ACCOUNT) at its start, later reads ACCOUNTS and then a branch file, BRANCHES. The branch record is missing. Where does control go?

    Choose one answer.

    Show the answer: One question

    Answer: To NO-ACCOUNT, because the HANDLE CONDITION applies to the whole program

    A condition handled by label is handled for every command that raises it. RESP on each command keeps the decision next to the command it belongs to.

Practise: commands, maps and responses

The questions cover the three sections above; each wrong choice names its slip.

Practice that adapts to you

Practise this lesson

9 questions about 6 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.

  1. Question 1 of 9 What does LINK do that XCTL does not?
    Show the answer: Question 1 of 9

    Answer: It returns control to the statement after the LINK when the called program ends

    The difference is where control goes when the called program issues RETURN.

  2. Question 2 of 9 What must come before a REWRITE of a record?

    Choose one answer.

    Show the answer: Question 2 of 9

    Answer: A READ of the same file with UPDATE

    READ with UPDATE holds the record; REWRITE replaces it and releases it. Without the READ, nothing is held, and the REWRITE returns INVREQ.

  3. Question 3 of 9 A menu program must start the update program, and it never needs control back. Which command fits, and why?

    Choose one answer.

    Show the answer: Question 3 of 9

    Answer: XCTL, because it releases the menu and runs the update program at the same logical level

    LINK when the caller needs control back, XCTL when it does not.

  4. Question 4 of 9 Which result of assembling map set UPDSET does AUPD copy into its source?

    Choose one answer.

    Show the answer: Question 4 of 9

    Answer: The symbolic map, assembled with SYSPARM=DSECT

    One source, two assemblies: the symbolic map for the program's names, the physical map for BMS.

  5. Question 5 of 9 The teller presses Enter without typing anything on the AUPD screen. What does RECEIVE MAP return?

    Choose one answer.

    Show the answer: Question 5 of 9

    Answer: MAPFAIL

    A screen whose only input field can be left empty must expect MAPFAIL from Enter as well as from CLEAR.

  6. Question 6 of 9 After a RECEIVE MAP that returned NORMAL, NEWMOBL is 0. What does that tell AUPD?

    Choose one answer.

    Show the answer: Question 6 of 9

    Answer: Nothing was typed into the field NEWMOB

    Each named field gets a length, an attribute and its data in the symbolic map. A program checks the length before it trusts the data.

  7. Question 7 of 9 What RESP2 value did the fake give AUPD's READ for AC00009999?

    Type a number.

    Show the answer: Question 7 of 9

    Answer: 80

    FAKECICS printed RESP 13, RESP2 80: the values IBM documents for NOTFND on a READ.

  8. Question 8 of 9 A program codes RESP on a READ and tests only for DFHRESP(NOTFND). The file is closed, and the READ returns NOTOPEN. What happens?

    Choose one answer.

    Show the answer: Question 8 of 9

    Answer: The program carries on as if the READ had worked, because with RESP CICS no longer ends the task

    Test NORMAL, the conditions you expect, and everything else, in that order. IBM's words for the price of RESP: the program must cope with whatever condition might arise.

  9. Question 9 of 9 Why does AUPD keep each CICS command in a paragraph of the copybook AUPDIO, instead of writing EXEC CICS inside CHANGE-MOBILE?

    Choose one answer.

    Show the answer: Question 9 of 9

    Answer: So that a test build can copy stub paragraphs and run every error path without CICS

    The seam between the rules and CICS is the paragraph: one build copies cics/AUPDIO.cpy, the other stubs/AUPDIO.cpy.

Every error path of AUPD proved with stubs, and the slip that hid a failure Pro: opens with a Pro, Premium or Ultimate pass

AUPD can end in five ways, and only one of them changes the file. This part runs all five against the stubs, reproduces a version that reported a change it never made, and has you write a fake REWRITE that answers as CICS does.

In this part:

  • Five cases, five outcomes, recorded
  • A program that never tested RESP, reproduced on the stubs
  • Write a fake REWRITE that a slip cannot pass
  • Write a fake REWRITE that answers as CICS does
    • Results of the sample tests

1 diagram · 5 runnable examples (COB, Python, Text) · 1 exercise with sample tests · about 7 minutes

Opening this part with your pass…

This part opens with any MySmartCoPilot pass.

  • Pro pass · 1 week₹79$2.99
  • 30 days₹179$5.99
  • 1 year₹1,699$45

One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

Units of work, SYNCPOINT and abends: what CICS backs out, with the totals Pro: opens with a Pro, Premium or Ultimate pass

A change that touches two records must be all or nothing. This part follows a transfer of 500.00 through five endings in a model of CICS’s rules, and shows the two designs that lose the money.

In this part:

  • What a unit of work commits, and when
  • Five endings of one transfer, with the totals
  • HANDLE ABEND and ABEND: ending a task on purpose

1 diagram · 1 runnable example (Python) · about 5 minutes

Opening this part with your pass…Pro part. It opens with the same pass as the part above.

From source to a running transaction: translator, map set and definitions Pro: opens with a Pro, Premium or Ultimate pass

None of the EXEC CICS lines is COBOL. This part follows AUPD from its source to a running transaction: the translator, the two assemblies of its map set, the bind, and the definitions CICS needs before the first teller presses Enter.

In this part:

  • The integrated translator turns EXEC CICS into CALLs
  • Two assemblies of one map set
  • Defining and refreshing the resources

1 diagram · about 5 minutes

Opening this part with your pass…Pro part. It opens with the same pass as the part above.

Interview questions

A warm-up, then three questions about update programs that went wrong:

  1. Mid to senior

    An old update program issues HANDLE CONDITION NOTFND(NO-ACCOUNT) at its start. After a change adds a READ of a branch file, a missing branch record shows tellers "No account with this number". Explain why, and how you move the program to RESP without changing what already works.

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page. First step and follow-ups

  2. Mid to senior

    Tellers see "Mobile number changed", yet some numbers were never changed on the file. Every command in the program codes RESP. What is the likely cause, how do you prove it without a CICS region, and what stops it coming back?

    Model answer, Pro. First step and follow-ups

  3. Senior to staff

    A transfer program debits one account and credits another. After abends, an audit finds debits without credits. Where can a transfer be split, what does CICS back out and what not, and how do you design the program so that a half-done transfer is never committed?

    Model answer, Pro. First step and follow-ups

Organisations named on this page

MySmartCoPilot has no connection with IBM. The commands, conditions and values here are from IBM’s documentation of CICS TS 6.x and Enterprise COBOL 6.5; the test builds ran under GnuCOBOL 3.2.

Flashcards · 8 cards

Recall it, then check

Say the answer to yourself before you look: recalling it is what makes it stick.

  1. What must come before a CICS REWRITE?

    A READ with UPDATE of the record, which holds it for the change. A REWRITE with nothing held ends with INVREQ.

  2. How do the CICS commands LINK and XCTL differ?

    LINK runs a program one logical level down, and control returns to the statement after the LINK. XCTL passes control at the same level for good and releases the program that issued it.

  3. What does RECEIVE MAP return when the user presses CLEAR, or Enter without typing?

    MAPFAIL: there is nothing to map. It ends the task unless the program handles it.

  4. What is a BMS map set made of, and what does assembling it give?

    DFHMSD for the map set, DFHMDI for each map and DFHMDF for each field, with its position, length and attributes. Assembled twice, it gives a physical map for BMS and a symbolic map the program copies.

  5. Which four names does the symbolic map give a field such as NEWMOB?

    NEWMOBL, how many characters were typed; NEWMOBA, the attribute byte; NEWMOBI, the typed text in the input map; NEWMOBO, the text to send in the output map.

  6. How does RESP differ from HANDLE CONDITION?

    HANDLE CONDITION sends a condition to one label for the whole program, so any later NOTFND lands there. RESP puts each command's outcome in a fullword binary field that the next line tests, and RESP2 says why.

  7. How can a CICS program's error paths be tested on a laptop?

    Keep each CICS command in a paragraph of a copybook, and build a test version whose stub paragraphs answer with IBM's RESP and RESP2 values, such as 13 and 80 for NOTFND on a READ.

  8. What do SYNCPOINT, ABEND and CEMT SET PROGRAM NEWCOPY do?

    SYNCPOINT commits a task's changes so far, and SYNCPOINT ROLLBACK backs them out. ABEND ends a task abnormally. NEWCOPY, or PHASEIN, loads a rebuilt program.

Key takeaways

  • CICS commands name their resources and end in NORMAL or a condition; a REWRITE needs a READ with UPDATE, and LINK returns to its caller, XCTL never.
  • BMS maps define a screen once, as a physical map for BMS and a symbolic map the program copies, and RECEIVE MAP returns MAPFAIL when there is nothing to map.
  • RESP hands every outcome to the program, which must test it, and a command in a paragraph of its own can be swapped for a stub that answers as CICS does.

Terms in this lesson

BMS map
A screen layout for CICS basic mapping support, defined with the DFHMDI and DFHMDF macros inside a map set. BMS uses it to build a 3270 screen from a program's data and to move the input back into named fields.
HANDLE CONDITION
An older CICS command that sends named conditions, such as NOTFND, to labels for the rest of the program, until a later HANDLE CONDITION or IGNORE CONDITION changes it or a command codes RESP or NOHANDLE.
map set
The unit in which BMS maps are defined and assembled, with the DFHMSD macro. Assembled twice, it gives a physical map, kept in the CICS load library for BMS, and a symbolic map that programs copy.
RESP option
An option of an EXEC CICS command that returns the command's outcome in a fullword binary field instead of letting CICS handle a condition. The program compares it with values such as DFHRESP(NORMAL) and must handle every outcome itself.
stub
A stand-in, written for tests, for a part that a program calls. It answers as the real part would, for example a paragraph that returns the RESP and RESP2 values of a CICS command on a computer without CICS.
symbolic map
The COBOL data definition made from a map set, which a CICS program copies. For each named field it holds a length, suffix L, an attribute, suffix A, and the data, inside an input map ending in I and an output map ending in O.

References

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.