CICS LabBook
CICS LabBook
CICS
Lab Book
Table of Contents
Document Revision History ................................................................................................ 2
Table of Contents ............................................................................................................... 3
Getting Started ................................................................................................................... 5
Overview ................................................................................................................ 5
Setup Checklist for CICS ....................................................................................... 5
Instructions ............................................................................................................ 5
Lab 1. Create Maps ........................................................................................................ 7
1.1: Compile and Submit the Map ......................................................................... 8
<<To Do>> ............................................................................................................ 8
Assignments (Part I): ............................................................................................. 8
<<To Do>> .......................................................................................................... 11
Lab 2. Translating and Compiling COBOL programs ................................................... 15
2.1: Code the following COBOL program ............................................................ 15
Lab 3. Display Current Date and Time ......................................................................... 18
3.1: Creating a map to display current date and time ......................................... 18
Lab 4. File Handling ...................................................................................................... 19
Assignments 1: .................................................................................................... 19
Assignments 2: .................................................................................................... 20
Lab 5. Analysis, Enhancement and Debugging Assignments ...................................... 22
Lab 6. Analysis, Enhancement and Debugging Assignments ...................................... 24
Functional components of the case study: .......................................................... 24
Lab 7. Browse records .................................................................................................. 26
5.1: Write a program for Customer Inquiry Module. ............................................ 26
Lab 8. Temporary Storage Queue ................................................................................ 27
6.1: Using TSQ in the MODIFY routine ............................................................... 27
Lab 9. Menu Handling ................................................................................................... 28
7.1: Creating a Menu driven application .............................................................. 28
Lab 10. Bank Application ............................................................................................ 30
1. Preface ................................................................................................................... 30
2. Project Requirements ........................................................................................... 30
3. Design Details ....................................................................................................... 30
3.1 File Layout ..................................................................................................... 30
Getting Started
Overview
This lab book is a guided tour for learning CICS. It comprises solved examples and ‘To
Do’ assignments. Follow the steps provided in the solved examples and work out the ‘To
Do’ assignments given.
Here is what is expected on your machine in order for the lab to work.
Minimum System Requirements
• Network PCs with Mainframe Connectivity
Instructions
<<To Do>>
Create a Map with the following fields (constants):
ABC LTD.
1. File Maintenance
2. Inquiry Program
Message: _________________________________________________
a. Create a data entry field named Choice with the following attributes:
LENGTH =1
INITIAL=CHAR
ATTRB=UNPROT, IC, FSET
b. Create a Stopper field for the Choice field, with the following attributes:
c. Create the Message field (Display-only) with the following attributes:
d. Define a Stopper field for the Message field.
e. Define a Dummy field with the following attributes.
<<To Do>>
Menu
1. Customer Maintenance
2. Customer Inquiry
Message: _______________________________________________
Note: The Choice field is a data entry field and the Message field is a display-only field.
The remaining fields are constants.
2. Key Screen:
Message: ___________________________________________________
Note: The Customer code field is a data entry field and the Message field is a display-
only field. The remaining fields are constants.
3. Detail Screen:
Modification/Inquiry/Data-entry
Name: ___________________
Address: ___________________
City: ___________________
Zip-Code: ___________________
Message: ___________________________________________________
Note: The Name, Address, City, and zip-code fields are data entry fields. The Customer
code, Message, and the Operator Message fields are display-only fields. The remaining
fields are constants.
Use following names for maps and mapsets:
Here we are working with one case study-Voting Eligibility which accept birth details online and
writing them into a Birth register with unique SSN thereby generating the VOTER ID.
Major tasks are as mentioned below:
• Accept the SSN of a person
• Check eligibility criteria to vote
• Generate voter-ID based on eligibility criteria.
• Modification of the birth details is also done.
Accept the person’s details depending on the choice.
1 – BIRTH REGISTRATION
2 – DEATH REGISTRATION
3 – BIRTH MODIFICATION
4 – VOTER REGISTRY
If choice is 1, BIRTH DETAILS are entered.
If choice is 2, DEATH DETAILS are entered.
If choice is 3, the details of birth can be modified.
If choice is 4, the person can check whether he is eligible for applying the Voter ID and if some
other choice is made other than these 4 options, an error message is displayed.
<<To Do>>
Problem 1:
Refer to shared file named ‘LOGIMAP’ for BMS coding
• The participants have to analyze the program, remove the error and successfully
execute the program.
• The participants have to document the error in the excel sheet along with steps
taken to resolve the errors.
Problem 2:
Refer to shared file named ‘MENMAP’ for BMS coding
• The participants have to analyze the program, remove the error and successfully
execute the program.
• BIRTH REGISTRATION choice is coded in the given program. Do enhance the
program for remaining choices such as DEATH REGISTRATION, BIRTH
MODIFICATION, VOTER REGISTRY, etc
• The participants have to document the error in the excel sheet along with steps
taken to resolve the errors.
Problem 3:
Create the following maps:
Registration Map
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-SWITCHES.
05 WS-END-SESSION PIC X(01) VALUE 'N'.
01 WS-END-SESSION-MSG PIC X(50) VALUE SPACES.
01 WS-COMM-AREA PIC X(01) VALUE SPACES.
*
COPY SAMPMAP.
COPY DFHAID.
LINKAGE SECTION.
01 DFHCOMMAREA PIC X(01).
**
PROCEDURE DIVISION.
0000-MAIN SECTION.
IF EIBCALEN = ZEROS
PERFORM 1000-FIRST-TIME
ELSE
MOVE DFHCOMMAREA TO WS-COMM-AREA
PERFORM 2000-SUBSEQUENT.
*
IF WS-END-SESSION = 'Y'
EXEC CICS
SEND TEXT
FROM(WS-END-SESSION-MSG)
LENGTH(+50)
ERASE
FREEKB
END-EXEC
EXEC CICS
RETURN
END-EXEC
ELSE
EXEC CICS
RETURN
TRANSID('TRN1')
COMMAREA(WS-COMM-AREA)
LENGTH(+1)
END-EXEC.
0000-EXIT.
EXIT.
*
1000-FIRST-TIME SECTION.
MOVE LOW-VALUES TO SAMPMAPI.
MOVE -1 TO CHOICEL.
EXEC CICS
SEND MAPSET('SAMPMAP')
MAP('SAMPMAP')
FROM(SAMPMAPI)
ERASE
FREEKB
CURSOR
END-EXEC.
1000-EXIT.
EXIT.
*
2000-SUBSEQUENT SECTION.
IF EIBAID = DFHENTER
PERFORM 2100-PROCESS-CHOICE
ELSE IF EIBAID = DFHPF10
MOVE 'SESSION ENDED' TO WS-END-SESSION-MSG
MOVE 'Y' TO WS-END-SESSION
ELSE
MOVE 'INVALID ATTENTION KEY PRESSED' TO MESSAGEI.
*
IF WS-END-SESSION NOT = 'Y'
PERFORM 2500-SEND-MAP.
2000-EXIT.
EXIT.
2100-PROCESS-CHOICE SECTION.
PERFORM 2110-RECEIVE-MAP.
IF CHOICEL = ZEROS OR CHOICEI = SPACES
MOVE 'YOU MUST ENTER CHOICE' TO MESSAGEO
ELSE
IF CHOICEI = 1
MOVE 'ASSIGN1 NOT READY' TO MESSAGEO
ELSE IF CHOICEI = 2
MOVE 'ASSIGN2 NOT READY' TO MESSAGEO
ELSE
MOVE 'INVALID CHOICE ' TO MESSAGEI.
2100-EXIT.
EXIT.
2500-SEND-MAP SECTION.
MOVE -1 TO CHOICEL.
EXEC CICS
SEND MAPSET('SAMPMAP')
MAP('SAMPMAP')
FROM(SAMPMAPI)
FREEKB
CURSOR
END-EXEC.
2500-EXIT.
EXIT.
2110-RECEIVE-MAP SECTION.
EXEC CICS HANDLE CONDITION
MAPFAIL(2110-MAP-FAIL)
END-EXEC.
EXEC CICS
RECEIVE MAPSET('SAMPMAP')
MAP('SAMPMAP')
INTO(SAMPMAPI)
END-EXEC.
GO TO 2110-EXIT.
2110-MAP-FAIL
MOVE 'MAP FAIL OCCURRED' TO WS-END-SESSION-MSG.
MOVE 'Y' TO WS-END-SESSION.
2110-EXIT.
EXIT.
DATE:
TIME:
MESSAGE:
• When user presses F12 AID key, the Date and Time should be displayed.
Goals • Getting familiar with the programs based on file handling concepts.
Time 8 hours
Assignments 1:
Refer to shared file named ‘File Read Prog’ for CICS-COBOL coding for business logic
• The participants have to analyze the program, structure the same as per the
coding standards, remove the error and successfully execute the program.
• The participants have to document the errors in the excel sheet along with steps
taken to resolve the errors.
• 'EMPS’ is a transaction used to return information pertaining to an employee
when the “EMPID” is entered on the screen.
• Create VSAM Cluster along with the employees data.
• The map as shown below and the working storage section of the emp-info are
given for your reference. Code BMS file for the given map.
• If the employee id is found the information has to be sent to the screen (Status
field) with the message “Emp Id: XXX found.”.
• If the emp-id key is not found then status field should array the message “Key not
found.” and the ‘EMP ID” field should be set to bright.
• If the Exit option is set to “Y” then the task has to terminated.
Structure of the VSAM KSDS dataset.
Working-Storage Section.
01 EMP-IOAREA.
05 EMP-REC.
10 EMP-KEY PIC XXX.
10 EMP-NAME PIC X(32).
10 EMP-SEX PIC X.
10 EMP-DEPT PIC X(10)
10 EMP-DESIG PIC X(5).
10 EMP-SAL PIC 9(7).
Employee ID :
Employee Name :
Employee Designation:
Sex:
Department :
Salary :
Status :
EXIT : X
Assignments 2:
• In case the record exists in the file, display following Operator Message on
the Detail screen.
F2-MODIFY, F4-DELETE, F3-KEY-SCREEN, F5-REFRESH
➢ To modify the record, key in data in all fields (except customer code),
and validate as follows:
o If any of the fields is blank, position the cursor on the invalid
field and display appropriate error message.
o If all the data is valid, press the F2 key to modify the record
in the dataset and the control should come back to the Key
screen.
o After the control comes to the Key screen, the Message
‘Record Modified’ should be displayed in the Message field
of the Key screen.
• After processing is done for add / modify / delete, the Key screen should be
displayed. The customer code, which got added / modified / deleted, should
get displayed on the Key screen with appropriate message ‘Record added /
Record modified / Record deleted’.
• For any map, if the user presses a wrong key, then display INVALID KEY
message in the error-message box.
• Make use of some variable of WS-COMM-AREA, to determine whether to
process KEY map, ADD map, or MODIFY map.
• Make use of sections while writing program code.
• Perform all necessary fields validations before proceeding further.
Problem 1:
Refer to shared program named NYPROJ.txt for CICS-COBOL partial coding.
• The participants have to analyze the program, remove the error and successfully
execute the program.
• In order to make it modular, divide the business logic into subprograms.
• The participants have to document the error in the excel sheet along with steps
taken to resolve the errors.
• Wherever required, enhance the given program to fulfill the given requirements
by developing the correct business logic.
• In the shared program, authorized user credentials are hard coded. Create a
separate dataset which will take care of user credentials and refer to the same in
the code as a good practice.
• Some of the constraints that need to take care are:
o If the person is dead, then the respective record in the VOTER register
will be deleted only if that entry is present in voter list and will be updated
in the DEATH file.
o The status is given whether the person is eligible for the voter registry.
o If the person is alive and his age is greater than 18yrs, then that person
is eligible to be in voter list.
o If he/she is dead or not having the required age then respective message
is displayed.
o The details of the people are taken and are updated in the corresponding
birth and death files.
o If the person is eligible then those are updated in the voter registry.
The Census management system will be used to produce statistics that are relevant to
data users and that every action in a census must be directed towards producing relevant
output that meets the needs of public.
Refer to shared files for BMS coding as well for COBOL Coding.
• The participants have to analyze the program, remove the error and successfully
execute the program.
• File named census.cbl contains incomplete COBOL coding which you need to
understand and complete as per the requirements of the system
• The participants have to document the error in the excel sheet along with steps
taken to resolve the errors.
Refer to shared file ‘INSURANCE POLICY PROCESSING SYSTEM’ for the problem.
Online Processing:
This is the initial step which will allow the Agent/Customer to create a new policy or the
customer can edit his existing policy. CICS would be used to create this OLTP (Online
Transaction Processing) System
Refer to the file structure and all other required details used in familiarization to MF
course.
Use TSQ in the MODIFY routine (Assignment of Lab 4) to determine whether record has
been changed during the current task’s pseudo-conversational cycle. For this use the
following procedure:
Step 1: READ the record for specified customer code.
Step 2: If record is found, store it in a TSQ.
Step 3: Send the DETAIL map to perform MODIFY or DELETE routine.
Step 4: For processing detail screen for modification, perform read with update. After this
I/O, again read the record with UPDATE option and now compare this record, which is
read, and the one, which is there in the TSQ. If both are same, it implies that no other
task has modified that record. So continue processing. If the comparison fails, then
display the message “Record has already been modified by someone. Enter the changes
again”.
Step 1: Integrate Assignments of lab 1, lab 4, lab 5 to create a Menu driven application.
• Accept the choice from the MENU program.
➢ In case the operator selects option 1, pass control to the
Maintenance (Assignment part IV) program, which will perform File
Maintenance. After exiting from the File Maintenance program, the
control should come back to the Menu program.
➢ In case the operator selects option 2, pass control to the Inquiry
(Assignment 5) program, which will perform the Inquiry. After exiting
from the Inquiry program, the control should come back to the Menu
program.
➢ Ensure that Assignment Part IV and Assignment Part V get executed
only through the Menu program. It should not get invoked through
transaction code.
1. Preface
The purpose of this document is to provide specification description of the module
exercise & document the project results on completion.
2. Project Requirements
ABC Bank of India wants to create an application to automate their Business. This
application should allow them to maintain their customer information and daily
transactions of debit or credit. Application needs to be created in CICS and
VSAM.
3. Design Details
❖ Input/Output:
Note: Key of the file is combination of date and transaction number. Transaction number
is created based on the xxxxxxHHMMSS (Account number x(06) and current time stamp
X(06))
Screen 1: This screen is the main screen and customer entry/view and updates are
managed in this screen. All the fields are mandatory except Balance field. Balance field
is for view only
Address : ____________________________________
Phone : ____________
Balance : 0000000.00
Message:
_______________________________________________________________
__________
============================================================
====================
PF2: REFRESH PF3: EXIT PF4: SAVE PF5: UPDATE
PF12: DELETE
PF13 – TRANS SCREEN PF14-REPORT1 PF15-REPORT2
Screen 2: This screen can be initiated from Customer entry screen by pressing PF13.
This screen is used to enter the transactions (Credit or Debit)
Transaction type : _
Amount : 000000.00
Message:
________________________________________________________________
_________
Report Screen 1:
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
xxxxxx xx:xx:xx x
000000.00
Message:
________________________________________________________________
_________
=============================================================
===================
PF2: REFRESH PF3: EXIT PF7: UP PF8:
Down
PF13 – CUST SCREEN PF14-TRANS SCREEN PF15-
REPORT2
Report Screen 2:
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
xxxx-xx-xx xx:xx:xx x
000000.00
Message:
________________________________________________________________
_________
=============================================================
===================
PF2: REFRESH PF3: EXIT PF7: UP PF8:
Down
Pseudo code
Screen 1: - Program 1: Customer Entry screen
1. User enters Account number and presses ENTER key: Account information needs to
be displayed based on the customer data available in the File.
a. If the customer information NOT FOUND then allow the user to type the rest
of the information.
b. If the customer information FOUND then allow the user to change the details,
(Except Balance) based on PF5 Key press update the changes. Based on
PF12 Key press delete the Account details
2. Enter all the information (Except Balance field – Protected) and press PF4: Insert the
record into ABCCUST file. If the account number already exists, display the error
message
3. PF13 Key press: Transfer the control to program 2 (Transaction Entry)
4. PF14 Key press: Transfer the control to Report program 1 (Daily report screen)
5. PF15 Key press: Transfer the control to Report program 2 (Customer report screen)
Screen 2: - Program 2: Transaction Entry screen
1. User enters Account number and presses ENTER key: Account Balance will be
displayed in the protected field.
2. Enter all the information (Except Balance field – Protected) and press PF4: Insert the
record into ABCTRAN file. If the account number not exists, display the error
message
3. PF13 Key press: Transfer the control to program 1 (Customer Entry)
4. PF14 Key press: Transfer the control to Report program 1 (Daily report screen)
5. PF15 Key press: Transfer the control to Report program 2 (Customer report screen)
2. PF7 – Read the previous page of records from TSQ and display
3. PF8 – Read the next page of records from TSQ and display
4. PF13 Key press: Transfer the control to program 1 (Customer Entry)
6. PF14 Key press: Transfer the control to Program 2 (Transaction Entry)
7. PF15 Key press: Transfer the control to Report program 2 (Customer report screen)
5. PF7 – Read the previous page of records from TSQ and display
6. PF8 – Read the next page of records from TSQ and display
7. PF13 Key press: Transfer the control to program 1 (Customer Entry)
2. PF14 Key press: Transfer the control to Program 2 (Transaction Entry)
3. PF15 Key press: Transfer the control to Report program 1 (Daily report screen)
Appendices
Figure 1: CEBR
Figure 2: CEBR
Figure 4: CEBR
Figure 6: Output
Also if the program name is not valid, Response is PGMIDERR. It means that the module
name entered is invalid or such a module does not exist.
Major functions:
• INQUIRE: To inquire about the status of CICS environments
• SET: To update the status of the CICS environments
• PERFORM: For further system operations
Example:
Objective: Close a file in CICS environment.
Steps:
Step 1: Type Command: CEMT SET FILE (H2537NBL)
As you can see, the file was earlier Open (Ope) and now after keying in the command
‘Clo’ the status of the file has changed to Close (Clo).
To open the file, issue command ‘Ope’ in similar fashion.
End the transaction by pressing PF3 key.
Lab Setup
Successful installation of Advantage CA-Realia WorkBench 3.2 IDE
(1) Move the Arrow keys and position it at the point where the heading
(constant) has to appear
vi) Press F9 to complete the definition of the field. Type the Initial value for the field
<<to do>>
Similarly, create a Map with the following fields (constants)
(1) Create a Data entry field named choice with the following attributes
(2) Create a Stopper field for the choice field, with the following attributes
(3) The map with the choice field and the stopper field should resemble the
following screen
(4) Create the Message field (Display-only) with the following attributes
(8) The final map should resemble the screen displayed below
vii) Press F5 to save the Map definition and F10 to exit the Map
<<to do>>
1) Select the Mapset from the appropriate directory.
2) View the additional files generated, after successful compilation of the
mapset.
3) View the sampmap.bms,sampmap.cbl file in any editor
II. Add appropriate entries in the PPT and PCT for the COBOL Program and the Mapset.
i. Select CICS system setup
iv. Add the following entry to associate the Transaction with the
program.
4. Select Build->Options->Program:<Undefined>…
6. Open the file sample.css in any editor and enter TRN1 as the
transaction.
<< to do >>
1) Enter the choice as 1,2,3 and note the message.
2) Press an invalid AID key and note the message
i. <<to do >>
1. Select Tools->CICS utilities-> CICS system setup…
iv. Specify the file type, length of the key field, maximum record length,
dsname
After adding the dataset to the FCT, the dataset can now be referred to in any
program, which references the dataset.
Figure 1: CEBR.............................................................................................................................. 39
Figure 2: CEBR.............................................................................................................................. 40
Figure 3: Browse ended message ................................................................................................. 41
Figure 4: CEBR.............................................................................................................................. 42
Figure 5: Typing the command ...................................................................................................... 43
Figure 6: Output ............................................................................................................................. 44
Figure 7: Response: Normal .......................................................................................................... 45
Figure 8: Response : INVREQ ...................................................................................................... 46
Figure 9: Response: PGMIDERR .................................................................................................. 47
Figure 10: Typing the command .................................................................................................... 48
Figure 11: Output ........................................................................................................................... 49
Figure 12: Typing Command ......................................................................................................... 50
Figure 13: Output ........................................................................................................................... 51
Figure 14: Session ended message .............................................................................................. 52
Figure 15: Typing command .......................................................................................................... 53
Figure 16: Output ........................................................................................................................... 54
Figure 17: Output ........................................................................................................................... 55
Figure 18: Output ........................................................................................................................... 56
Figure 19: Typing the CEDF command ......................................................................................... 57
Figure 20: Output ........................................................................................................................... 58
Figure 21: Typing the command .................................................................................................... 59
Figure 22: Output ........................................................................................................................... 60