196
1 CICS Customer Information Control System Training Material . HCL TECHNOLOGIES

CICS Tutorial - HCL - Vijayanand M - 40145533

Embed Size (px)

Citation preview

Page 1: CICS Tutorial - HCL - Vijayanand M - 40145533

1

CICS

Customer Information Control System

Training Material

.

HCL TECHNOLOGIES

Page 2: CICS Tutorial - HCL - Vijayanand M - 40145533

2

Customer Information Control System

Objectives of the course

To get an introduction to CICS and CICS`s working environment To learn to write programs effectively in

CICS To learn to develop efficient CICS

applications

Page 3: CICS Tutorial - HCL - Vijayanand M - 40145533

3

Customer Information Control System

SESSION # 1

Page 4: CICS Tutorial - HCL - Vijayanand M - 40145533

4

Batch System V/S Online System

Input Data from card,tape,disk. Data from terminal. In Batch, Sequential, Random, concurrent. Scheduled Can be entered as data E.g. Keypunch,Data Coding arrive. Update Reserved during a job. Concurrent.Of file Other jobs have to wait. Instant.

File I/O I/O must be in sequence. I/O can be concurrent. Output Printed reports,O/P files. Messages thrown to

console, Updated files System log, Reports.

Page 5: CICS Tutorial - HCL - Vijayanand M - 40145533

5

Batch System V/S Online System

Start of Operator (or OS) initiates Entering Trans-ID job job. triggers the transaction.

Process Single task & thread Multitask & Multithreadmode Priority in job scheduling. Priority processing.

End of job Each job. Each transaction .

Turn- Usually much longer. Almost Instantaneous.around

Resources Less Usage. More Usage.

Appln. Monthly Sales Report. Airline Reservation .

Page 6: CICS Tutorial - HCL - Vijayanand M - 40145533

6

INTRODUCTION TO CICS

CICS is one of the most popular DB / DC(Data Base / Data Communication) Control System.Also, it is an Online Transaction Processor OLTP.

Macro Level : Initial version of CICS was Macro Level, under which application programs used Assembler-macros for requesting CICS services. This work was quite cumbersome &

required special skills.

Command Level : In the later upgraded version, CICS commands are high level language version of macros, one

command achieves service achieved by series of macros.Development became more easier.

Page 7: CICS Tutorial - HCL - Vijayanand M - 40145533

7

INTRODUCTION TO CICS (contd...)

Product Operating System.

CICS / MVS Ver. 2 Release 1 MVS/XA,MVS/ESA

CICS / OSVS Ver. 1 Release 7 MVS/XA,MVS

CICS / DOS/VSE Ver. 1 Release 7 VSE

CICS / VM Ver. 2 Release 1 VM/SP

CICS / OS / 2 OS/2

Page 8: CICS Tutorial - HCL - Vijayanand M - 40145533

8

FEATURES OF CICS

Easy to develop on-line applications.

Common interface to database and Data sets.

Better response time.

Easy to customize.

Coding similar to high level Languages.

Continued ...

Page 9: CICS Tutorial - HCL - Vijayanand M - 40145533

9

FEATURES OF CICS(Contd...)

No need to code for displaying data onto the screen.

Easy forms development using BMS facility.

Device independence.

Data independence.

Sharing of code between applications.

Page 10: CICS Tutorial - HCL - Vijayanand M - 40145533

10

VSAMDiskFiles

CICS Appln.Program

VTAM / TCAM

Terminal Users

Page 11: CICS Tutorial - HCL - Vijayanand M - 40145533

11

OPERATING SYSTEM

Database AccessMethod

(DL/1,DB2)

Data AccessMethod

(VSAM, BDAM)

TelecommunicationAccess Method

(VTAM, TCAM)

OtherSystems

Terminals

CICS / MVS

Data-handlingFunctions

System Services

MonitoringFunctions

ApplicationProgramServices

Data-CommFunctions

CICS Application Programs(COBOL, PL/1, Assembler)

DataStorage

Page 12: CICS Tutorial - HCL - Vijayanand M - 40145533

12

VOCABULARY

Multi User Multi Tasking Multi Programming Multi Threading Job Task Transaction Reentrancy Quasi Reentrancy

Page 13: CICS Tutorial - HCL - Vijayanand M - 40145533

13

MULTITASKING

Multitasking means that the operating system (OS) allows more than one task to be executed concurrently, regardless of whether the tasks use the same program or different programs.

Page 14: CICS Tutorial - HCL - Vijayanand M - 40145533

14

MULTITHREADING

Multithreading is the system environment where the tasksare sharing the same program under the multitasking environment.Under the multithreading environment, a program is shared by several tasks concurrently. For each task, the program must work as if it were executing instructions exclusively for each task.

Page 15: CICS Tutorial - HCL - Vijayanand M - 40145533

15

REENTRANCY

In order to make multithreading possible, an applicationprogram must be reentrant.A reentrant program is a program which does not modify itself so that it can reenter to itself and continue processing after an interruption by the operating system.

Page 16: CICS Tutorial - HCL - Vijayanand M - 40145533

16

CICS COMPONENTS

Control Programs ( Management Modules)

Control Tables

Control Blocks

CICS core nucleus consists of Control Programs & their corresponding Control Tables.

Page 17: CICS Tutorial - HCL - Vijayanand M - 40145533

17

Control Program Control Tables

File Control Program File Control Table

Interval Control Program Interval Control Table

Journal Control Program Journal Control Table

Program Control Program Processing Program Table

Task Control Program Program Control Table

Storage Control Program Storage Control Table

Terminal Control Program Terminal Control Table

Temporary Storage Program Temporary Storage Table

Transient Data Program Destination Control Table

Page 18: CICS Tutorial - HCL - Vijayanand M - 40145533

18

CONTROL BLOCKS

EXEC Interface Block (EIB) :CICS provides system related information to

each task in the form of Exec interface block.

Since the information is automatically provided by CICS the application program can use it straightaway.

Some of the most commonly used EIB information are

EIBAID : Value of last Attention identifier key pressed (1 BYTE ).

Continued...

Page 19: CICS Tutorial - HCL - Vijayanand M - 40145533

19

EIB INFORMATION (contd...)

EIBCALEN : Length of DFHCOMM AREA ( S9 (4) COMP ) .

EIBDATE : Date when this task is Initiated. ( S9 (4) COMP-3 ).

EIBFN : Function code of the last CICS command in HEX (2 BYTES).

EIBRCODE : Response code of the last function ( 6 BYTES )

Continued...

Page 20: CICS Tutorial - HCL - Vijayanand M - 40145533

20

EIB INFORMATION (contd...)

EIBTASKN : Task Number of the Current Task ( S9 (7) COMP-3 ).

EIBTIME : Time when the Current Task was started ( S9 (7) COMP-3 ).

EIBTRMID : Terminal-ID from where task Initiated ( 1-4 characters ).

EIBTRNID : Transaction-id of Current Task (1-4 characters ).

Page 21: CICS Tutorial - HCL - Vijayanand M - 40145533

21

CICS STARTUP:Starting up of an CICS system involves executing a job

(JCL) like any other batch-job.

Main job-step is System Initialization Program (SIP).

SIP loads corresponding System Initialization Table (SIT),

based on which SIP further loads all control programs and tables

and performs initial house-keeping tasks.Then CICS is ready to

execute CICS transactions within its own region.

CICS SHUTDOWN :The computer operator terminates CICS job by entering

Master Terminal Transaction (CEMT) with shut-down option. Then CICS job produces various logs, statistics, dumps & reports

Page 22: CICS Tutorial - HCL - Vijayanand M - 40145533

22

GENERAL SYNTAX OF CICS STATEMENT

EXEC CICS <FUNCTION> Option 1(arguments …) Option2(arguments …) ... END EXEC.

Basic Steps in CICS Application Program Development :

CICS Commands are embedded in the host language e.g. COBOL, PL/I .

Translate, Compile, Link-edit an application program into Program library(Load-lib). Continued...

Page 23: CICS Tutorial - HCL - Vijayanand M - 40145533

23

Basic Steps in CICS Application Program Development :

Translate, compile and linkedit a CICS application program into the CICS application program library (LOADLIB).Define Trans-ID into PCT with associated program name. Define program into PPT .Register Terminal into TCT.Register the user in SNT(Sign-On Table). Other CICS tables e.g. FCT, JCT, DCT must be prepared for the application programming if required.Sign-On CICS and enter Trans-ID.

Page 24: CICS Tutorial - HCL - Vijayanand M - 40145533

24

In addition to the above basic procedures, the detailed CICSsystem environment must be prepared properly by the systemprogrammers or application programmers. For example :

The terminal must be registered in the TCT.

The CICS user identifier must be registered in the SNT.

Other CICS tables (viz. FCT, JCT, DCT) must be prepared for the application program, if required.

Additional Preparation Required

Page 25: CICS Tutorial - HCL - Vijayanand M - 40145533

25

COBOL Program with

CICS Statements

CICS Preprocessor

COBOL Source Code

COBOL Compiler

Object Module

LinkerLoad

Module

STEPS IN APPLICATION DEVELOPMENT

Page 26: CICS Tutorial - HCL - Vijayanand M - 40145533

26

INITIATION OF CICS TRANSACTION

There are five ways of initiating CICS transactions :1. By a transaction identifier entered in a terminal with ENTER key.2. By a transaction identifier associated with a terminal for pseudo-conversation.3. By the START command, which initiates a transaction specified in the parameter.4. By the Automatic Task Initiation (ATI).5. By a 3270 attention identifier. For an IBM 3270 type terminal any of the PF and PA keys could be defined in PCT to initiate a CICS transaction.

Page 27: CICS Tutorial - HCL - Vijayanand M - 40145533

27

USER ENTERS TRANS-ID (AAAA)

PCT

Transaction Program

AAAA AAAPGM1BBBB BBBPGM1CCCC CCCPGM2

CICS locates trans-idAAAA in program control table

PPT

Program Location

AAAPGM1 On DiskBBBPGM1 In StorageCCCPGM2 On Disk

CICS locates programAAAPGM1 in the processing programtable

Library Load Module

ORDPROG AAAPGM1ORGPROG BBBPGM1DDMPROG CCCPGM2

CICS locates load moduleAAAPGM1 on disk, loadsit into memory, and startsthe task

CICS Address Space

AAAPGM1

BBBPGM1

Page 28: CICS Tutorial - HCL - Vijayanand M - 40145533

28

SIGN ON -The primary function of CICS SIGN ON is to associate CICS user identifier with CICS system in terms of security, Priority and other functions.CESN or CSSN is CICS supplied transaction which prompts SIGN ON screen as shown. Complete SIGN ON by giving

correct USERID & PASSWORD Unless SIGN ON process is complete NO CICS transaction can be invoked.

SIGN OFF- Primary functions of SIGN OFF is to disassociate CICS user identifier from CICS Region. For SIGN OFF use CICS supplied transaction CSSF.

CICS/VS SIGNON - enter userid

USERID:PASSWORD:

Page 29: CICS Tutorial - HCL - Vijayanand M - 40145533

29

CICS SERVICES

Terminal Control

Program Control

File Control

Basic Mapping Support ( B M S )

Transient Data & Temporary Storage Control

Interval & Task Control

Storage Control

Page 30: CICS Tutorial - HCL - Vijayanand M - 40145533

30

TERMINAL CONTROL SERVICE

SESSION # 2

Page 31: CICS Tutorial - HCL - Vijayanand M - 40145533

31

INTRODUCTION

The CICS Terminal Control Program (TCP) providescommunication services between application programs andterminals, using the information defined in the Terminal Control Table. Usually, unformatted screens are used for the Terminal Control Operations.

Page 32: CICS Tutorial - HCL - Vijayanand M - 40145533

32

TERMINAL CONTROL COMMANDS IN CICS

SEND – To print text onto the terminal screen

RECEIVE – To receive data into a variable from the terminal

CONVERSE – To send data to terminal and receive data from terminal

ISSUE PRINT – To print all data onto the screen on printer

ISSUE COPY – To copy one terminal screen to other

HANDLE AID – To handle keys pressed on terminal

Page 33: CICS Tutorial - HCL - Vijayanand M - 40145533

33

SEND COMMAND SYNTAXEXEC CICS

SEND FROM (Literal / Variable)LENGTH (Literal / Variable)

END-EXEC.

Eg: EXEC CICS SEND FROM (“Enter the Number ”) LENGTH (20) END-EXEC.

EXEC CICS SEND FROM (SCR-MESSAGE) LENGTH (WS-MESSAGE-LEN)

END-EXEC.(WS-MESSAGE-LEN is a WORKING-STORAGE variable )

Page 34: CICS Tutorial - HCL - Vijayanand M - 40145533

34

RECEIVE COMMAND SYNTAX

EXEC CICSRECEIVE INTO (Variable)LENGTH (Literal / Variable)

END-EXEC.

Eg: EXEC CICS RECIEVE INTO (SCR-VAR) LENGTH (20) END-EXEC. EXEC CICS RECIEVE INTO (SCR-VAR) LENGTH (WS-MESSAGE-LEN) END-EXEC.(SCR-VAR is WS variable into which value is to be received)

Page 35: CICS Tutorial - HCL - Vijayanand M - 40145533

35

CONVERSE COMMAND

The CONVERSE Command performs the combined functions of the SEND command with Invite option and RECIEVE command.

The CONVERSE command sends data to other partner transaction during the conversation, automatically switches the communication state from the send state to receive state, inviting the other partner transaction to send the data and then receives data from other partner transaction.

This CONVERSE command is used in Inter System Communication type of Intercommunication .

Continued...

Page 36: CICS Tutorial - HCL - Vijayanand M - 40145533

36

CONVERSE COMMAND SYNTAX

EXEC CICS CONVERSE FROM (Literal/Variable) [FROMLENGTH (Length)] INTO (Variable) [TOLENGTH (Length)] [ERASE]END-EXEC.

Eg: EXEC CICS CONVERSE FROM (“Enter a Number”)

INTO (WS -VAR) ERASE

END-EXEC.(WS-VAR is a WORKING-STORAGE variable)

Page 37: CICS Tutorial - HCL - Vijayanand M - 40145533

37

ISSUE PRINT COMMAND

The ISSUE PRINT Command is used to make a hard copy of Screen on the local printer.

Syntax:

EXEC CICSISSUE PRINT

END-EXEC.

Page 38: CICS Tutorial - HCL - Vijayanand M - 40145533

38

ISSUE COPY COMMAND

The ISSUE COPY Command is used to copy a screen image of the terminal into another terminal.

Syntax:

EXEC CICSISSUE COPY

TERMID (Terminal Name)END-EXEC.

Page 39: CICS Tutorial - HCL - Vijayanand M - 40145533

39

HANDLE AID COMMAND SYNTAX

EXEC CICSHANDLE AID

Attention Key1 (Routine1)Attention Key2 (Routine2)Attention Key3 (Routine3)

END-EXEC.

Eg: EXEC CICS HANDLE AID

PF1 (PF1-Routine) PF2 (PF2-Routine)

END-EXEC.( PFx-Routines are to be coded by Application Programmer )

Page 40: CICS Tutorial - HCL - Vijayanand M - 40145533

40

SOME TIPS ON HANDLE AID COMMAND

HANDLE AID tells the program what to do when the user presses an Attention Identifier -AID key.

It itself does not detect the key pressed.

It is always used in association with RECEIVE command.

DFHAID is the library member having all the key values- Continued

Page 41: CICS Tutorial - HCL - Vijayanand M - 40145533

41

TIPS ON HANDLE AID COMMAND(contd...)

In WORKING-STORAGE SECTION. * DFHAID is Copy Book to be included. COPY DFHAID.

The system variable EIBAID holds the AID value after RECEIVE command.

This value is compared with AID key definition from copy book.

Thus, HANDLE AID PF3 is equivalent to IF EIBAID = DFHPF3

Page 42: CICS Tutorial - HCL - Vijayanand M - 40145533

42

PROGRAM CONTROL

SESSION # 3

Page 43: CICS Tutorial - HCL - Vijayanand M - 40145533

43

PROGRAM CONTROL IN CICS

OBJECTIVES :

To know more on program control, inter-program communication and inter-program Calls

Data transfer between programs

Modes of CICS application programming

Introduction to COBOL-CICS macro level programming

Page 44: CICS Tutorial - HCL - Vijayanand M - 40145533

44

PROGRAM CONTROL Program Control Program is responsible for managing the use

of all application programs

The PCP uses the information available in PPT to manage the flow of control between programs

Functions of Program Control are To load programs into virtual storage

To monitor the flow of control between CICS and Application programs

To monitor the flow of control between application programs

Page 45: CICS Tutorial - HCL - Vijayanand M - 40145533

45

INTERPROGRAM COMMUNICATIONPassing data between programs

Sending program specifies the data area, which is to pass data to the calling program in the WORKING-STORAGE SECTION.

Receiving program receives it into the data area defined in the LINKAGE SECTION.

Normally the LS area is DFHCOMMAREA.

The length of the COMMAREA passed by the program is available in the system variable EIBCALEN in DFHEIBLK copybook.

Page 46: CICS Tutorial - HCL - Vijayanand M - 40145533

46

PASSING DATA BETWEEN PROGRAMS

TRANSID: TRN1Program 1

Working-storage Section

TRANSID: TRN2

Program 2

Procedure Division. . . . .

RETURNTRANSID(TRN2)COMMAREA(COM)

Linkage Section.

» EIBCALEN contains the Size of COM

COM

COMMAREA

DFHCOMMAREA

Page 47: CICS Tutorial - HCL - Vijayanand M - 40145533

47

COMMANDS FOR PROGRAM CONTROL

LOAD – Load a program into the CICS address space

RELEASE – Release the program from CICS address space

LINK – Call another program at the lower logical level

XCTL – Transfer control to another program at the same logical level

RETURN – Return to immediate higher logical level

Page 48: CICS Tutorial - HCL - Vijayanand M - 40145533

48

LOAD command

The LOAD Command is used to load a program or table which is independently compiled or assembled & link-edited and

registered in PPT .

This command is useful for loading a table or application program dynamically. That is, as an application, a table can be coded in Assembler, assembled and link-edited. Then COBOL

program can load it as a table.

Continued...

Page 49: CICS Tutorial - HCL - Vijayanand M - 40145533

49

LOAD command Syntax

EXEC CICS LOAD PROGRAM (Program Name)[SET (Pointer Reference)][LENGTH (Data Area Length)][LENGTH (Data Area Length)][ENTRY (Pointer Reference)][HOLD]

END-EXEC .

Page 50: CICS Tutorial - HCL - Vijayanand M - 40145533

50

Important Parameters :

PROGRAM - Program to be loaded into CICS address spaceSET – Pointer reference to the address of Table/Program/MapLENGTH – S9(4) COMP. Length of module (if length < 32 k)FLENGTH – S9(8) COMP. (if length > 32 k)HOLD –Module resident in memory even when task terminates

LOAD command Syntax

Page 51: CICS Tutorial - HCL - Vijayanand M - 40145533

51

LOAD command

Example:EXEC CICS LOAD

PROGRAM (‘lodprg’)SET (ptrvar)LENGTH (lenvar)

END-EXEC .

Exceptions:PGMIDERR – Program not foundLENGERR – Load module > 32 KNOAUTH – Security check error

Page 52: CICS Tutorial - HCL - Vijayanand M - 40145533

52

RELEASE command

Release Command is used to release a program or table which has been loaded previously.

Name of program must be specified in PROGRAM parameter.

Page 53: CICS Tutorial - HCL - Vijayanand M - 40145533

53

EXEC CICS RELEASEPROGRAM (Program Name)

END-EXEC.

Parameters :

PROGRAM - Name of the program to be released

RELEASE command Syntax

Page 54: CICS Tutorial - HCL - Vijayanand M - 40145533

54

LINK command

The LINK Command is used to pass Control from an application program at one logical level to another

application program at the next lower logical level.

The calling program expects control to be returned to it. Data can be passed to the called program through

communication area parameter called COMMAREA.

This command is the equivalent of CALL in COBOL.

Page 55: CICS Tutorial - HCL - Vijayanand M - 40145533

55

EXEC CICS LINKPROGRAM (Program Name)COMMAREA (Data-Area)LENGTH (Len)DATALENGTH (Len)INPUTMSG (Data-Area)INPUTMSGLEN (Len)SYSID (value)SYSCONRETURNTRANSID (value)

END-EXEC.

LINK command syntax

Page 56: CICS Tutorial - HCL - Vijayanand M - 40145533

56

Important Parameters :

PROGRAM - Program to be linked.COMMAREA - Data area to be passed to the called

programLENGTH - S9(4) COMP. Length of data area to be

passedINPUTMSG - Data area to be passed to the called

program as an inputINPUTMSGLEN - S9(4) COMP. Length of data area to be

passed as input

LINK command Syntax

Page 57: CICS Tutorial - HCL - Vijayanand M - 40145533

57

CICS SYSTEM

First Program:LINK

Second Program:RETURN

LINK flow of control

Page 58: CICS Tutorial - HCL - Vijayanand M - 40145533

58

XCTL command

The XCTL Command is used to pass control from a application program to another application program at

the same logical level.

It does not expect control to be returned.

Like LINK, in this command also, data can be passed through COMMAREA to the called program.

This command is similar to the CHAIN command in COBOL.

Page 59: CICS Tutorial - HCL - Vijayanand M - 40145533

59

EXEC CICS XCTLPROGRAM (Program Name)COMMAREA (Data-Area)LENGTH (Len)INPUTMSG (Data-Area)INPUTMSGLEN (Len)

END-EXEC.

XCTL command Syntax

Page 60: CICS Tutorial - HCL - Vijayanand M - 40145533

60

Important Parameters :

PROGRAM - Program to be XCTLed.COMMAREA - Data area to be passed to the called

programLENGTH - S9(4) COMP. Length of data area to be

passedINPUTMSG - Data area to be passed to the called

program as an inputINPUTMSGLEN - S9(4) COMP. Length of data area to be

passed as input

XCTL command Syntax

Page 61: CICS Tutorial - HCL - Vijayanand M - 40145533

61

CICS SYSTEM

First Program:XCTL

Second Program:RETURN

XCTL flow of control

Page 62: CICS Tutorial - HCL - Vijayanand M - 40145533

62

DIFFERENCE BETWEEN LINK & XCTL

Program 1.

CICS

Program 2.

LINK

Program 1.

CICS

Program 2.

XCTL

Page 63: CICS Tutorial - HCL - Vijayanand M - 40145533

63

RETURN command syntax

EXEC CICS RETURNTRANSID (TRNID)COMMAREA (Commarea)LENGTH (Length of Commarea)IMMEDIATEINPUTMSG (Data-Area)INPUTMSGLEN (Len)

END-EXEC.

Page 64: CICS Tutorial - HCL - Vijayanand M - 40145533

64

RETURN command syntax

Important Parameters :

TRANSID - Transaction id of the next program to start after the return of the current one.

COMMAREA - Data area to be passed to the next program

LENGTH - S9(4) COMP. Length of data area to be passed

IMMEDIATE - Parameter to start the next transaction immediately after the execution of the RETURN command, without user intervention

Page 65: CICS Tutorial - HCL - Vijayanand M - 40145533

65

Modes of Application Programming

CONVERSATIONAL

NON CONVERSATIONAL

PSEUDO CONVERSATIONAL

Page 66: CICS Tutorial - HCL - Vijayanand M - 40145533

66

Modes of Application Programming

Conversational Direct interaction of user with the system System waits for the user input

Non Conversational Only 1 request from user to system

Continued...

Page 67: CICS Tutorial - HCL - Vijayanand M - 40145533

67

Modes of Application Programming

Pseudo Conversation

User interaction with the system

System releases the resources associated with the program while waiting for user input

System regains the resources when user gives input

Page 68: CICS Tutorial - HCL - Vijayanand M - 40145533

68

RESTRICTIONS in COBOL when using CICS

Data related entries cannot be used inENVIRONMENT DIVISION &

DATA DIVISION.

Following statements in COBOL cannot be used in CICS.

IDENTIFICATION DIVISIONNo restrictions

ENVIRONMENT DIVISION• SELECT Statement

Continued...

Page 69: CICS Tutorial - HCL - Vijayanand M - 40145533

69

RESTRICTIONS in COBOL when using CICS

DATA DIVISION• FD Entry• REPORT SECTION

PROCEDURE DIVISION• SORT • RELEASE • RETURN

Debugging Statements• EXHIBIT • TRACE

Continued...

Page 70: CICS Tutorial - HCL - Vijayanand M - 40145533

70

RESTRICTIONS in COBOL when using CICS

PROCEDURE DIVISIONI/O Statements• ACCEPT • DISPLAY

File Handling commands• OPEN • CLOSE • READ • WRITE • REWRITE • DELETE

Continued...

Page 71: CICS Tutorial - HCL - Vijayanand M - 40145533

71

RESTRICTIONS in COBOL when using CICS

PROCEDURE DIVISIONProgram Termination commands• STOP RUN• EXIT PROGRAM• GOBACK

String Handling statements• STRING• UNSTRING• INSPECT• EXAMINE

Continued...

Page 72: CICS Tutorial - HCL - Vijayanand M - 40145533

72

RESTRICTIONS in COBOL when using CICS

PROCEDURE DIVISIONCalendar commands• CURRENT-DATE• DATE• DAY

Page 73: CICS Tutorial - HCL - Vijayanand M - 40145533

73

FILE CONTROL

SESSION # 4

Page 74: CICS Tutorial - HCL - Vijayanand M - 40145533

74

INTRODUCTION

The CICS File Control Program (FCP) provides application programs with services to Read, Update, Add, and Delete records in a file (dataset).

In addition it makes application programs independent of the structure of the database, while it manages exclusive control over the records, in order to maintain the data integrity during record updates.CICS supports the following VSAM Datasets :

LDS : Linear Data SetESDS : Entry Sequenced Data Set

KSDS : Key Sequenced Data SetRRDS : Relative Record Data Set

Continued...

Page 75: CICS Tutorial - HCL - Vijayanand M - 40145533

75

FILE CONTROL SERVICE(contd)

Data independence is a concept of program being independent of structure of data access methods.

CICS File Control provides data independence to application programs,so programmer does not have to be concerned with data dependent COBOL parameters or JCL as-

INPUT-OUTPUT SECTIONSELECT statementFD entryOPEN/CLOSEJCL

Continued...

Page 76: CICS Tutorial - HCL - Vijayanand M - 40145533

76

FILE CONTROL SERVICE(contd)

Data set names have to be registered in File Control Table (FCT) by System Programmer to specify characteristics of file.

Files are automatically opened and closed by Master Terminal Transaction ( CEMT).

During Update, a program gets exclusive control over the record being updated

Continued...

Page 77: CICS Tutorial - HCL - Vijayanand M - 40145533

77

FILE CONTROL SERVICE(contd)

Available Commands -

READ : Read a Record

WRITE :Write a Record

REWRITE : Update a Record

DELETE : Delete a Record

UNLOCK : To release Exclusive control acquired for

update

Page 78: CICS Tutorial - HCL - Vijayanand M - 40145533

78

READ COMMAND SYNTAX

EXEC CICS READINTO (rec-area) // Record to be read LENGTH (length) // Length of recordDATASET (filename) // File nameRIDFLD (key-area) // Key[GENERIC KEYLENGTH( )] // Partial key[GTEQ / EQUAL] // Appropriate Condition[UPDATE] // Read for UPDATE

END-EXEC.Eg: EXEC CICS READ

INTO ( CustRec) DATASET (CustMast) END-EXEC.

Page 79: CICS Tutorial - HCL - Vijayanand M - 40145533

79

EXAMPLE

Suppose that file FILEAAA has records in the following order :

BO001BC001DC001DC002NY000NY001NY002PH001PH002

Page 80: CICS Tutorial - HCL - Vijayanand M - 40145533

80

WORKING-STORAGE SECTION.77 WK-LEN PIC S9(4) COMP.01 FILE-IOAREA.

05 REC-A.10 REC-A-KEY

15 REC-A-KEY-CITY PIC XX.15 REC-A-KEY-SEQ PIC 999.

10 REC-A-DETAIL PIC X (30)...PROCEDURE DIVISION.

MOVE 35 TO WK-LEN.MOVE ‘NY001’ TO REC-A-KEY.EXEC CICS READ

DATASET(‘FILEAAA’)INTO(FILE-IOAREA)RIDFLD(REC-A-KEY)LENGTH(WK-LEN)

END-EXEC.

Page 81: CICS Tutorial - HCL - Vijayanand M - 40145533

81

READ COMMAND SYNTAX

EXCEPTIONS:

LENGERR – Record length mismatch with file

INVREQ – Read operation not permitted as

It is not mentioned in the FCT

Record is locked

NOAUTH – Resource acquisition failed

NOTFND – Record not found

ENDFILE – End of File

Page 82: CICS Tutorial - HCL - Vijayanand M - 40145533

82

REWRITE COMMAND

A combination of the READ command with the UPDATE option and the REWRITE command is used to update a record. Between these two commands, exclusive control over the record will be maintained for this task, so that no other task can access this record for update.

Page 83: CICS Tutorial - HCL - Vijayanand M - 40145533

83

REWRITE COMMAND SYNTAX

EXEC CICS REWRITE FROM (rec-area) DATASET (filename) LENGTH (length)

END-EXEC.

Eg: EXEC CICS REWRITE

FROM (CustRec)

LENGTH (20)

DATASET (‘CustMast’)

END-EXEC.

Page 84: CICS Tutorial - HCL - Vijayanand M - 40145533

84

WRITE COMMAND SYNTAX EXEC CICS WRITE

FROM (rec-area) LENGTH (length)DATASET (filename)RIDFLD (key-area)MASSINSERT // Allows group of records

END-EXEC. // simultaneouslyEg: EXEC CICS WRITE

FROM (FILE-IOAREA)

LENGTH (WK-LEN)

DATASET (‘FILEAAA’)

RIDFLD(REC-A-KEY)

END-EXEC.

Page 85: CICS Tutorial - HCL - Vijayanand M - 40145533

85

DELETE COMMAND SYNTAX

// To delete a record after it has been ReadEXEC CICS DELETE

DATASET (filename)END-EXEC.

// To delete a record/group satisfying certain conditionEXEC CICS DELETE

DATASET (filename)RIDFLD(data-area)[GENERIC][RBA/RRN]

END-EXEC.

Page 86: CICS Tutorial - HCL - Vijayanand M - 40145533

86

UNLOCK COMMAND SYNTAX

EXEC CICS UNLOCK DATASET (filename)

END-EXEC.

Release EXCLUSIVE control and terminate MASSINSERT.While using WRITE command with MASSINSERT option, Application has Exclusive control over whole file.

Page 87: CICS Tutorial - HCL - Vijayanand M - 40145533

87

BROWSE COMMANDS

CICS provides a special set of browse commands

STARTBR

READNEXT

READPREV

RESETBR

ENDBR

Continued...

Page 88: CICS Tutorial - HCL - Vijayanand M - 40145533

88

ORDER OF BROWSE OPERATION

EVENTS COMMANDS1. Start.2. Establish starting position STARTBR3. Retrieve a record. READNEXT

OR READPREV4. If processing of the record is required, then process and go to step 3.5. If more records are required, then go to step 3.6. If it is required to establish another position, then restablish the new position and go to step 3. RESETBR7. Terminate the BROWSE operation. ENDBR8. End.

Page 89: CICS Tutorial - HCL - Vijayanand M - 40145533

89

STARTBR COMMAND SYNTAX

To initiate and establish position for BROWSE.

EXEC CICS STARTBRDATASET (filename)RIDFLD (key-area)[GENERIC][GTEQ / EQUAL][RRN / RBA ]

END-EXEC.Exceptions:INVREQ – Read operation not permittedNOTFND – Record not found

Page 90: CICS Tutorial - HCL - Vijayanand M - 40145533

90

READNEXT COMMAND SYNTAX

Retrieving records sequentially in ascending sequence.

EXEC CICS READNEXTINTO (rec-area)DATASET (filename)RIDFLD (key-area)LENGTH (length)RBA/RRN

END-EXEC.

Page 91: CICS Tutorial - HCL - Vijayanand M - 40145533

91

READPREV COMMAND SYNTAX

Retrieving records sequentially backwards (in descending order):

EXEC CICS READPREV DATASET (filename)INTO (rec-area)RIDFLD (key-area)LENGTH (length)REQID (data-value)

END-EXEC.

Page 92: CICS Tutorial - HCL - Vijayanand M - 40145533

92

RESETBR COMMAND SYNTAX

Altering the starting position of current Browse operation

EXEC CICS RESETBRDATASET (filename)RIDFLD (key-area)[REQID (data-value)][GTEQ / EQUAL]

END-EXEC.

Page 93: CICS Tutorial - HCL - Vijayanand M - 40145533

93

ENDBR COMMAND SYNTAX

Ending the current Browse operation:

EXEC CICS ENDBRDATASET (filename)[REQID (data-value)]

END-EXEC

Page 94: CICS Tutorial - HCL - Vijayanand M - 40145533

94

BASIC MAPPING SUPPORT

SESSION # 5

Page 95: CICS Tutorial - HCL - Vijayanand M - 40145533

95

BASIC MAPPING SUPPORT in CICS

OBJECTIVES : To know about...

Terminal Control

The usage of maps in CICS

Different types of maps

Creating and using maps effectively

Introduction to SDF

Page 96: CICS Tutorial - HCL - Vijayanand M - 40145533

96

The CICS Terminal Control Program(TCP) provides

communication services between user-written applications and terminals, using information

defined in the Terminal Control Table (TCT).

IBM TERMINALS

Page 97: CICS Tutorial - HCL - Vijayanand M - 40145533

97

Many types terminals are supported by CICS for data communication.

A few examples....

IBM 3270 Information Display System IBM 3600 Finance Communication System IBM 8775 Advanced terminals

Normally, 3270 are the most commonly used terminals with Mainframes

IBM TERMINALS

Page 98: CICS Tutorial - HCL - Vijayanand M - 40145533

98

IBM TERMINALS

To communicate with any of these terminals, the data should be sent in their native mode. i.e., they must

receive data stream in their native mode called Native Mode Data Stream (NMDS).

NMDS is mixture of Buffer Control characters and Text data which is unique for individual terminal types based on their hardware protocol.

Page 99: CICS Tutorial - HCL - Vijayanand M - 40145533

99

NMDS for an IBM 3270 terminal

S F - Start of field Character

C Info. Field 1 Field 2.....

Field 1

Text Data Attr Byte S F Addr C Info. Output Data Stream

Input Data Stream

Text Data Addr C. Info

Field1

Attr Byte

Page 100: CICS Tutorial - HCL - Vijayanand M - 40145533

100

IBM TERMINALS

Problems with NMDS are that it is... Device Dependent (Hardware specific) Format Dependent Difficult to code

To make the application programs independent of terminal hardware we go for device and format independent Basic Mapping Support, shortly BMS.

Page 101: CICS Tutorial - HCL - Vijayanand M - 40145533

BASIC MAPPING SUPPORT

BMS is an interface between the application program and the terminal

BMS maps device independent data into device dependant data to provide a formatted

screen

BMS identifies the location and characteristics of data fields as well as the characteristics of the terminal with which the map will be used

Page 102: CICS Tutorial - HCL - Vijayanand M - 40145533

102

FUNCTIONS OF BMS

To remove device dependent codes and constantinformation from an application and to place them in maps thereby simplifying programming job.

Keeps Code largely independent of Any changes in network of terminals Any changes in the terminal types

Other functions include... Processing text Page building Multiple screens of data Message Routing

Page 103: CICS Tutorial - HCL - Vijayanand M - 40145533

103

MAP & MAPSET

MAP

Representation of one formatted screen

MAPSET

Collection of one or more map(s)

Page 104: CICS Tutorial - HCL - Vijayanand M - 40145533

104

TYPES OF MAPS

PHYSICAL MAP

It is a program in the form of a load module.

It is a table equivalent of screen layout.

It resides in the program load library.

It is loaded when executing program requests send/receive BMS services.

Page 105: CICS Tutorial - HCL - Vijayanand M - 40145533

105

TYPES OF MAPS

SYMBOLIC MAP

It is a group structure of COBOL variable declaration for map fields.

It resides in the COPY books library.

It is copied into the source program by the compiler during compilation of CICS application program.

Page 106: CICS Tutorial - HCL - Vijayanand M - 40145533

106

GENERATION OF MAPS

BMS Macro

ASSEMBLE

Symbolic Map

Link - Edit

Physical Map

COPY LIB LOAD LIB

Page 107: CICS Tutorial - HCL - Vijayanand M - 40145533

107

USING MAPS IN A PROGRAM

Symbolicmap

Load Module&

Physical map

Copy Library

Load Library

SourceCode CICS Translator

COBOL Compiler

Link Edit

Page 108: CICS Tutorial - HCL - Vijayanand M - 40145533

108

Coding an Assembler macro

General syntax of an Assembler Macro...

Name Operation Operands

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .... 70 71 72

Page 109: CICS Tutorial - HCL - Vijayanand M - 40145533

109

Coding an Assembler macro

An ‘*’ in Col. 1, notifies that it is a comment line Name field for a mapset / map / field starts from Col. 1 Operation field starts at Col. 10 Operands field starts at Col. 16 Any line continued to the next line, should have a non- blank character in Col. 72 and should start after Col. 2 in the next line Operands should be separated by commas without

spaces in-between them. END is coded in columns 9 through 11 to delimit the

program.

Page 110: CICS Tutorial - HCL - Vijayanand M - 40145533

110

Coding a BMS macro

Macro definition for Fields, Maps and Mapsets :-

DFHMSD defines a Mapset one per mapset / BMS file

DFHMDI defines a Map one per Map & one or more Maps per Mapset

DFHMDF defines a Field one per field & one or more Fields per Map

Page 111: CICS Tutorial - HCL - Vijayanand M - 40145533

111

DFHMSD

This Operation denotes that the definitions are for a Mapset and defines the mapset properties

which consists of one or more maps.

The Operands, apart form other things, specify whether the program will generate physical maps or symbolic maps or both while assembling the code specify whether the maps will be used as I/P, O/P or both

Continued...

Page 112: CICS Tutorial - HCL - Vijayanand M - 40145533

112

DFHMSD Syntax

MAPSETA DFHMSD TYPE = | DSECT / MAP / FINAL |,// DSECT-Symbolic Map MAP- Physical Map Final-Last map

MODE= | IN / OUT / INOUT |,// Specifies Input / Output / Input Output Mode

LANG = |ASM / COBOL / PL1 |,// Specifies the host language TERM = |ALL / 3270 |,// Terminal type ALL if supports all / 3270 IBM terminal

STORAGE = AUTO// Each map will have separate storage area

TIOAPFX = | YES / NO | ,// If YES puts filler(12) for control info.

CTRL=(PRINT,FREEKB,ALARM)// PRINT -Hard copy / FREEKB- Frees kbd. ALARM-sound it

Page 113: CICS Tutorial - HCL - Vijayanand M - 40145533

113

DFHMDI

This Operation denotes that the definitions are for a Map and defines the Map properties which consists of one or more fields.

The Operands, apart form other things,

specify the size and position of the map on the screen

Continued...

Page 114: CICS Tutorial - HCL - Vijayanand M - 40145533

114

DFHMDI Syntax

Mapname DFHMDI SIZE = (LINE,COLUMN), JUSTIFY = | LEFT / RIGHT |,

CTRL = (ctrl1,ctrl2,…)

// This CTRL has precedence over the definition in Map Set

Page 115: CICS Tutorial - HCL - Vijayanand M - 40145533

115

DFHMDF

This Operation denotes that the definitions are for a Field within a Map.

The Operands, apart form other things, specify the length and relative position of the field on the map specify the attributes of the field specify the default values for the field specify whether the field is part of a group variable or not, etc.

Page 116: CICS Tutorial - HCL - Vijayanand M - 40145533

116

DFHMDF Syntax

Fieldname DFHMDF POS=(LINE,COLUMN), //Specifies position in the Map.

LENGTH=<1 TO 255>, // Specifies SizeINITIAL=’<value>’, // Initialize textGROUPNAME=<GROUPNAME>,

//Allows Subdivision of fieldPICIN = ‘<pic_clause>’,PICOUT = ‘<pic_clause>’,

// For formatting fields E.g. : $99.99 / 999.99DBJUSTIFY=|LEFT/BLANK/RIGHT/ZERO|,OCCURS= <Number_of_Occurrences>,ATTRB=(attr1,attr2…)

//Specifies characteristics of field

Page 117: CICS Tutorial - HCL - Vijayanand M - 40145533

117

DFHMDF ATTRIBUTES

1. ASKIP / PROT / UNPROT//Specifies Auto-skip / Protected / Unprotected field2. IC// Insert Cursor initializes cursor position 3. BRT / NORM / DRK // Bright / Normal / Dark Intensity of field4. NUM// Numeric field type5. FSET//Field Set (MDT ON)6. DET// PEN Detectable

Page 118: CICS Tutorial - HCL - Vijayanand M - 40145533

118

MODIFIED DATA TAG (MDT)

MDT indicates whether the data field is modified or not.

If the MDT is ON for a field, then that data is transmitted to the program.

If MDT is OFF , no data is transmitted for that field.

Page 119: CICS Tutorial - HCL - Vijayanand M - 40145533

119

Sample BMS Coding...1 10 1617 72MAPSETA DFHMSD TYPE=MAP,MODE=INOUT, X

CTRL=(FREEKB,FRSET), X LANG=COBOL,TERM=3270

MAP1 DFHMDI SIZE=(24,80),TIOAPFX=Y DFHMDF POS=(1,10),LENGTH=6, X

INITIAL = ‘T I L.’DATE DFHMDF POS=(1,20),LENGTH=8

DFHMDF POS=(3,10),LENGTH=10, X INITIAL=‘ENTER NAME’

NAME DFHMDF POS=(3,25),LENGTH=20, X ATTRB = IC

MAP2 ......

MAP3 ...... DFHMSD TYPE=FINAL //Indicates end of Mapset declaration

END

Page 120: CICS Tutorial - HCL - Vijayanand M - 40145533

120

SENDING MESSAGE TO SCREEN

EXEC CICSSEND MAP (‘MAP1’)MAPSET (‘MAPSETA’)

END-EXEC.

SYMBOLICMAP

PHYSICALMAP

OUTPUT DATASTREAM

Page 121: CICS Tutorial - HCL - Vijayanand M - 40145533

121

SENDING MESSAGE (MAPONLY)

EXEC CICSSEND MAP (‘MAP1’)MAPSET (‘MAPSETA’) MAPONLY

END-EXEC.PHYSICAL

MAP

OUTPUT DATASTREAM

Page 122: CICS Tutorial - HCL - Vijayanand M - 40145533

122

SENDING MESSAGE (DATAONLY)

EXEC CICSSEND MAP (‘MAP1’)MAPSET (‘MAPSETA’) DATAONLY

END-EXEC.SYMBOLIC

MAP

OUTPUT DATASTREAM

Page 123: CICS Tutorial - HCL - Vijayanand M - 40145533

123

COMMON ERRORS WITH MAPS

MAPFAIL More predominant error. Normally occurs when there is no data to be transmitted but the user uses any AID keys and receives the input.

INVREQ Receive Command executed without a map on the screen.

INVMPSZ Size of the map specified is larger than the screen.

Page 124: CICS Tutorial - HCL - Vijayanand M - 40145533

124

COPY BOOKS TO BE INCLUDED FOR USING BMS

.........

WORKING-STORAGE SECTION.COPY DFHAID.

//TO USE FUNCTION KEY RESPONSESCOPY DFHBMSCA.

//BMS COMMON WORK AREACOPY SYMBMAP1.

//USER DEFINED MAP

PROCEDURE DIVISION. ....

Page 125: CICS Tutorial - HCL - Vijayanand M - 40145533

125

SCREEN DEFINITION FACILITY (SDF)

SDF is an interactive screen definition software which works under CICS or TSO. This is an additional product supplied by IBM. Advantages of using SDF

Interactive and direct definition of Screens on Terminals. SDF automatically generates BMS macro code. So programmers are relieved from the troubles of coding Assembler macros. Provides interactive TEST facility. Provides some additional utilities like COPY, DELETE, RENAME functions & Directory Listing.

Page 126: CICS Tutorial - HCL - Vijayanand M - 40145533

126

EXCEPTION HANDLING

SESSION # 6

Page 127: CICS Tutorial - HCL - Vijayanand M - 40145533

127

EXCEPTION HANDLING IN CICS

RESP

HANDLE CONDITION

IGNORE CONDITION

HANDLE AID

HANDLE ABEND

Page 128: CICS Tutorial - HCL - Vijayanand M - 40145533

128

RESP OPTION

The RESP option can be specified in any CICS command.Its function is similar to the return code in a batch program. If the RESP option is specified in a command , CICS places aresponse code at the completion of the command. The applicationprogram can check this code, then proceed to the next processing.This approach has an advantage over the HANDLE CONDITION approach, because this makes the program morestructured.

Page 129: CICS Tutorial - HCL - Vijayanand M - 40145533

129

The following is the procedure to use the RESP option in a CICScommand :

1. Define a fullword binary field (S9(8) COMP) in the WorkingStorage Section as the response field.

2. Place the RESP option with the response field in a command.

3. After command execution, check the response code in the response field with DFHRESP(xxxx), where xxxx is : • NORMAL for normal completion.

• Any exceptional comdition.

Page 130: CICS Tutorial - HCL - Vijayanand M - 40145533

130

Example :

WORKING-STORAGE SECTION.77 WS-RETCODE PIC S9(8) COMP.

PROCEDURE DIVISION...EXEC CICS SEND FROM (_____) LENGTH(___) ERASE RESP(WS-RETCODE)END-EXEC..IF WS-RETCODE = DFHRESP(NORMAL) GO TO NORMAL-PARA.IF WS-RETCODE = DFHRESP(LENGERR) GO TO LENGERR-PARA.GO TO GENERAL-ERR-PARA.

NORMAL-PARA.LENGERR-PARA.

Page 131: CICS Tutorial - HCL - Vijayanand M - 40145533

131

During the execution of this program, the following will occur :

• At the completion of the SEND command, the WS-RETCODE field will have the response code of the command execution result.

• If the SEND command completes normally, control will be passed to NORMAL-PARA.

• If a LENGERR is encountered , control will be passed to LENGERR-PARA.

• If any other exceptional condition is encountered, control will bepassed to GENERAL-ERR-PARA.

Page 132: CICS Tutorial - HCL - Vijayanand M - 40145533

132

HANDLE CONDITION COMMAND

EXEC CICS HANDLE CONDITION

Exception Condition1 (ROUTINE 1)

Exception Condition2 (ROUTINE 2)

Exception Condition3 (ROUTINE 3)

END-EXEC.

Page 133: CICS Tutorial - HCL - Vijayanand M - 40145533

133

EXAMPLE

EXEC CICS HANDLE CONDITIONERROR(GEN-ERR-RTN)LENGERR(LENGERR-RTN)

END-EXEC.EXEC CICS RECEIVE

INTO(WK-TIOA)LENGTH(WK-LEN)

END-EXEC.......LENGERR-RTN.........................................GEN-ERR-RTN..............................................

Page 134: CICS Tutorial - HCL - Vijayanand M - 40145533

134

IGNORE CONDITION COMMAND

The IGNORE CONDITION command causes no action to be taken if the specified condition occurs in the program. The control will be passed on to the instruction following the command whichencountered the exceptional condition.

The request by the IGNORE CONDITION command is valid until the subsequent HANDLE CONDITION for the same condition.

Page 135: CICS Tutorial - HCL - Vijayanand M - 40145533

135

Syntax :

EXEC CICS IGNORE CONDITION condition (condition)END-EXEC.

The “condition” indicates an exceptional condition. At the most, only 12 conditions are allowed in the same command.

Page 136: CICS Tutorial - HCL - Vijayanand M - 40145533

136

EXAMPLE

EXEC CICS IGNORE CONDITION LENGERREND-EXEC.EXEC CICS RECEIVE INTO(_______) LENGTH(____)END-EXEC.

• At the execution of the RECEIVE command, if LENGERR exception occurs, the condition will be ignored, and the controlwill be passed to the statement after the RECEIVE command.

Page 137: CICS Tutorial - HCL - Vijayanand M - 40145533

137

HANDLE AID COMMAND

Used to execute a routine depending on a key pressed

Always used with RECEIVE command

Syntax :

EXEC CICS HANDLE AID

attention id1 (ROUTINE1)

attention id2 (ROUTINE2)

attention id3 (ROUTINE3)

END-EXEC.

Page 138: CICS Tutorial - HCL - Vijayanand M - 40145533

138

EXAMPLE

EXEC CICS HANDLE AIDPF3(END-ROUTINE)PA1(CANCEL-ROUTINE)ENTER(NORMAL-ROUTINE)ANYKEY(WRONG-KEY-ROUTINE)

END-EXEC.

Page 139: CICS Tutorial - HCL - Vijayanand M - 40145533

139

HANDLE ABEND COMMAND

The HANDLE ABEND command is used to intercept an abnormal termination (ABEND) in a program, and to activate, cancel or reactivate an exit for the ABEND processing.

The HANDLE CONDITION command intercepts the abnormalconditions of the CICS command execution whereas HANDLE ABEND intercepts abnormal termination.

Page 140: CICS Tutorial - HCL - Vijayanand M - 40145533

140

Syntax :

EXEC CICS HANDLE ABEND [PROGRAM(name) | LABEL(label) | CANCEL | RESET ]END-EXEC.

PROGRAM or LABEL is used to pass control to a program or aparagraph , respectively, for ABEND processing.CANCEL is used to cancel the previously established HANDLEABEND request.RESET is used to reactivate the previously cancelled HANDLE ABEND request.

Page 141: CICS Tutorial - HCL - Vijayanand M - 40145533

141

EXAMPLE

WORKING-STORAGE SECTION.77 MSG-LEN PIC S9(4) COMP.01 MSG-DATA. 05 MSG-DATA1 PIC X(15). 05 MSG-DATA2 PIC X(50).:PROCEDURE DIVISION.:EXEC CICS HANDLE ABEND LABEL(ABEND-ROUTINE)END-EXEC.:ABEND-ROUTINE.MOVE ‘ABEND OCCURED.’ TO MSG-DATA1.MOVE ‘TASK CANCELLED WITH ABCODE 9999.’ TO MSG-DATA2.MOVE 65 TO MSG-LEN.EXEC CICS SEND FROM (MSG-DATA) LENGTH(MSG-LEN) NOHANDLEEND-EXEC.

Page 142: CICS Tutorial - HCL - Vijayanand M - 40145533

142

EXEC CICS HANDLE ABEND CANCELEND-EXEC.EXEC CICS ABEND ABCODE(‘9999’)END-EXEC.

During the execution of the program, the following activities willoccur :• If an ABEND occurs, it will be intercepted by the HANDLE ABEND command, and control will be passed to ABEND-ROUTINE.• At the completion of the HANDLE ABEND/CANCEL command,the previous HANDLE ABEND request will be cancelled.• At the completion of the ABEND command, the task will be terminated with user code ‘9999’.

Page 143: CICS Tutorial - HCL - Vijayanand M - 40145533

143

TRANSIENT DATA QUEUES

SESSION # 7

Page 144: CICS Tutorial - HCL - Vijayanand M - 40145533

144

TRANSIENT DATA QUEUE

OBJECTIVES

To get an introduction on Transient Data Queue

To learn to use TD Queues

Page 145: CICS Tutorial - HCL - Vijayanand M - 40145533

145

TRANSIENT DATA CONTROL

Sequential data sets called Transient Data Files are used by CICS for inter-region and intra-region data transfer

This is facilitated by Transient Data Control Program (TDP), which allows CICS transaction to deal with these files

Transient Data Files, also called as Transient Data Queue (TDQ) or Transient Data Destination, can

be used as either I/P or O/P files, but not both

Continued ...

Page 146: CICS Tutorial - HCL - Vijayanand M - 40145533

146

TRANSIENT DATA CONTROL

The term Queue is used because records are accessed in sequential mode, as in a queue

The Term destination indicates, that most often these sequential data are directed to other transaction or

other- wise called Destination

Each TDQ is identified by 1-4 character identifier called “Destination -id”, which are to be registered in

Destination Control Table (DCT)

Page 147: CICS Tutorial - HCL - Vijayanand M - 40145533

147

TRANSIENT DATA CONTROL

Types of TD Queues...

INTRA PARTITION TDQ A group of sequential records which are produced & processed by same and/or different Transactions within the same CICS region.

All Intra partition TD Queues are stored in one VSAM physical file in the CICS region which is prepared by system programmer and maintained by CICS Continued ...

Page 148: CICS Tutorial - HCL - Vijayanand M - 40145533

148

TRANSIENT DATA CONTROL

INTRA PARTITION TDQ (cont.) From application programmers point of view one record is used at a time sequentially

TDQ is a Destructive Read-out queue ; i.e Once read record, is logically removed from the Queue

Some typical applications of Intra partition TD Queues Interface among CICS Transactions Pgm. 1------TDQ------pgm. 2------Report Automatic Task Initiation (ATI) Message Routing Message Broadcasting

Page 149: CICS Tutorial - HCL - Vijayanand M - 40145533

149

TRANSIENT DATA CONTROL

Types of TD Queues... (cont.)

EXTRA PARTITION TDQ

A group of sequential records which interface between transactions of different CICS regions and other systems outside CICS region

In Input Extra Partition TDQ, records are created by programs outside the CICS region, (like...batch jobs, TSO, PC etc.) and are processed by CICS transactionContinued ...

Page 150: CICS Tutorial - HCL - Vijayanand M - 40145533

150

TRANSIENT DATA CONTROL

EXTRA PARTITION TDQ (cont.)

In Output Extra Partition TDQ, records are created by CICS transaction and are processed by other systems or another CICS region

Each TDQ is a separate physical file and the destination may be a disk/tape/printer/plotter

Therefore for its use, each file must be opened by the CICS region, when used by a Transaction

Continued ...

Page 151: CICS Tutorial - HCL - Vijayanand M - 40145533

151

TRANSIENT DATA CONTROL

EXTRA PARTITION TDQ (cont.)

DCP with DCT determines the Open/Close status of the file

Files can also be Opened/Closed dynamically through Master Terminal Transaction (CEMT) during an active CICS session

Continued ...

Page 152: CICS Tutorial - HCL - Vijayanand M - 40145533

152

TRANSIENT DATA CONTROL

EXTRA PARTITION TDQ (cont.)

Some typical applications of Extra Partition TD Qs

Interface to Batch (or TSO or PC ) jobs

CICS App. pgm-----TDQ-----File-----Batch job.

Interface from Batch (or TSO or PC ) jobs

Batch job-----TDQ-----File-----CICS App. pgm.

Page 153: CICS Tutorial - HCL - Vijayanand M - 40145533

153

TRANSIENT DATA CONTROL

TDQ Commands

WRITEQ TD - Writes record in Q for both types

READQ TD - Read record from Q for both types

DELETEQ TD - To delete an Intra Partition TDQ Not Valid for Extra

Partition TDQ

TD in the commands stands for Transient Data ; if omitted the same command defaults to TSQ

Page 154: CICS Tutorial - HCL - Vijayanand M - 40145533

154

TRANSIENT DATA CONTROL

WRITEQ TD Syntax

EXEC CICS WRITEQ TDQUEUE ( <name> )FROM ( data-area )[ LENGTH ( data-value ) ]

END-EXEC.

EXCEPTIONS QIDERR - DCT entry not found for the ‘Q’ LENGERR - length specified is greater than maximum length given in DCT NOSPACE - no space available in TDQ

Page 155: CICS Tutorial - HCL - Vijayanand M - 40145533

155

TRANSIENT DATA CONTROL

READQ TD Syntax

EXEC CICS READQ TDQUEUE ( <name> )INTO ( data-area )[ LENGTH ( data-value ) ]

END-EXEC.

EXCEPTIONS QIDERR - DCT entry not found for the ‘Q’ LENGERR - length specified is not the same as that specified in DCT QZERO - no more items to read in the ‘Q’

Page 156: CICS Tutorial - HCL - Vijayanand M - 40145533

156

TRANSIENT DATA CONTROL

DELETEQ TD Syntax

EXEC CICS DELETEQ TDQUEUE ( <name> )

END-EXEC.

EXCEPTIONS

QIDERR - DCT entry not found for the ‘Q’

Page 157: CICS Tutorial - HCL - Vijayanand M - 40145533

157

DESTINATION CONTROL TABLE

DCT`s primary function is to register Control Information of all TD Queues

Destination Control Program uses this DCT for identifying all TD Queues and perform input/output operations against them

DCT entries are defined using Assembler macros into DFHDCT for both types of TD Queues (parameters & options for both types is quite different)

Page 158: CICS Tutorial - HCL - Vijayanand M - 40145533

158

AUTOMATIC TASK INITIATION (ATI)

ATI is a facility through which another transaction can be initiated automatically

When the number of records in an Intra Partition TDQ reaches a particular level, the system triggers the

transaction to start

The Trans-id is defined in the DCT entry of the Intra Partition TDQ with non-zero trigger level to initiate

a particular transaction

Continued ...

Page 159: CICS Tutorial - HCL - Vijayanand M - 40145533

159

AUTOMATIC TASK INITIATION (ATI)

Applications...

Message SwitchingMessages can be accumulated

in a TDQ (Intra Partition) and at certain level, say 1000, another transaction may be started to route the messages to a different destination

Report Print Similarly records can be

accumulated, and at certain trigger level another transaction can be started to print the records

Page 160: CICS Tutorial - HCL - Vijayanand M - 40145533

160

TEMPORARY STORAGE QUEUES

SESSION # 8

Page 161: CICS Tutorial - HCL - Vijayanand M - 40145533

161

TEMPORARY STORAGE CONTROL

Temporary Storage Control Program (TSP) provides application program with ability to store & retrieve data in Temporary Storage Queues (TSQ) .

Characteristics of TSQs :

TSQ is Queue of records stored , which is created dynamically without any entries in control tables.

TSQ is identified by Queue-ID (1 to 8 bytes) & record within Queue is identified by relative position called Item Number.

Continued ...

Page 162: CICS Tutorial - HCL - Vijayanand M - 40145533

162

CHARACTERISTICS OF TSQS (contd...)

Application programs use TSQs as scratch pad memory facility for any purposes.

Records once stored remain accessible until entire TSQ is deleted. Records can be Read sequentially or directly also they can be Reread & Updated.

TSQ may be written in main storage or auxillary storage in DASD.

Irrespective of place stored can be accessed by any Transaction in that CICS region.

Continued ...

Page 163: CICS Tutorial - HCL - Vijayanand M - 40145533

163

CHARACTERISTICS OF TSQS (contd...)

TSQ is in main storage hence more efficient than TDQ.

Only problem is if crash occurs then contents are lost, no chance of retrieval as in case of TDQs.

Typical Applications :

Data passing between Transactions.

Report Printing , typically one prg writes in TSQ and other prints report using this TSQ.

Continued...

Page 164: CICS Tutorial - HCL - Vijayanand M - 40145533

164

TSQ AVAILABLE COMMANDS

WRITEQ TS : To Write & Rewrite record in TSQ.

READQ TS : To Read record from TSQ.

DELETEQ TS : To delete TSQ.

TD in command is for Transient Data if omitted Default is TS Temporary Storage Queue.

Page 165: CICS Tutorial - HCL - Vijayanand M - 40145533

165

EXAMPLEWORKING-STORAGE SECTION.01 TSQ-QID.

05 TSQ-QID-DIV PIC X VALUE ‘A’.05 TSQ-QID-TERM PIC X(4).05 TSQ-QID-APPL PIC X.05 TSQ-QID-NUM PIC 99.

01 TSQ-DATA.05 TSQ-FIELD1 PIC X(50).05 TSQ-FIELD2 PIC X(150).

77 TSQ-LEN PIC S9(4) COMP.77 TSQ-ITEM PIC S9(4) COMP.

PROCEDURE DIVISION.....................CONSTRUCT QID.

MOVE EIBTRMID TO TSQ-QID-TERM.MOVE ‘I’ TO TSQ-QID-APPL.MOVE 1 TO TSQ-QID-NUM.

...................(Edit TSQ data)..................MOVE 200 TO TSQ-LEN.

Contd...............

Page 166: CICS Tutorial - HCL - Vijayanand M - 40145533

166

WRITE A QUEUE.

EXEC CICS WRITEQQUEUE(TSQ-QID)FROM(TSQ-DATA)LENGTH(TSQ-LEN)ITEM(TSQ-ITEM)MAIN

END-EXEC.

EXAMPLE ........(Contd.)

N.B. : If a TSQ with this QID does nort exist, a TSQ will be created with QID=AttttI01,where tttt is the terminal id.

Page 167: CICS Tutorial - HCL - Vijayanand M - 40145533

167

INTERVAL & TASK CONTROL

SESSION # 9

Page 168: CICS Tutorial - HCL - Vijayanand M - 40145533

168

INTERVAL CONTROL & TASK CONTROL

OBJECTIVES

To know more on Interval Control and Time related functions

To know more on Task management

Page 169: CICS Tutorial - HCL - Vijayanand M - 40145533

169

INTERVAL CONTROL

CICS Interval Control Program ( ICP ) provides application program a variety of time related

functions, such as current date & time, ATI of time ordered tasks etc.

There are specific commands available for CICS-ICP to handle with the time and date functions.

Page 170: CICS Tutorial - HCL - Vijayanand M - 40145533

170

INTERVAL CONTROL

A few ICP Commands...

ASKTIME - to request Current Date & Time FORMATTIME- to select Format of Date & Time DELAY - to Delay processing of a task WAIT EVENT - to wait for an event to occur START - to start a Transaction POST - to request notification when

specified time has expired RETRIEVE - to retrieve data stored by START

command for the transaction CANCEL - to cancel effect of previous

interval control command

Page 171: CICS Tutorial - HCL - Vijayanand M - 40145533

171

INTERVAL CONTROL

VARIOUS DATE / TIME FORMATS

DDMMYY / MMYYDD / YYMMDD / YYDDD DATE / DATESEP / DATEFORM YEAR TIME / TIMESEP DAYOFWEEK / DAYOFMONTH DAYCOUNT MONTHOFYEAR

NOTE : In the latest release of CICS, year is in YYYY format

Page 172: CICS Tutorial - HCL - Vijayanand M - 40145533

172

INTERVAL CONTROL

Scheduled Transaction Initiation (STI) Scheduled Transaction Initiation (STI) is an

important application of the START command, by which CICS transactions can be initiated automatically at scheduled time or intervals.

EXEC CICS STARTTRANID(‘ABCD’) TERMID(‘TTTT’) TIME( 090000 )

END-EXEC.// ABCD will be initiated at 9.00 AM

Page 173: CICS Tutorial - HCL - Vijayanand M - 40145533

173

TASK CONTROL

CICS Task Control Program ( KCP ) provides functions to synchronize task activities and to gain exclusive control over resources In other words TASK CONTROL refers to the CICS functions that manage the execution of tasks It is mainly concerned with the task dispatcher that dispatches the tasks according to priority CICS automatically provides exclusive control over resources to a task in most of the cases. However for certain sharable resources ENQ & DEQ should be used for maintaining integrity, like for TSQ updating, Printer Handling etc.,

Page 174: CICS Tutorial - HCL - Vijayanand M - 40145533

174

TASK CONTROL

A few KCP Commands...

ENQ - to gain exclusive control over resource

DEQ - to release resource on exclusive control

SUSPEND - to suspend a task

Page 175: CICS Tutorial - HCL - Vijayanand M - 40145533

175

INTERCOMMUNICATION

SESSION # 10

Page 176: CICS Tutorial - HCL - Vijayanand M - 40145533

176

INTER COMMUNICATION

MULTI REGION OPERATION &INTER SYSTEM COMMUNICATION

OBJECTIVES

To get an introduction on MRO and ISC

Page 177: CICS Tutorial - HCL - Vijayanand M - 40145533

177

INTER COMMUNICATION

CICS Inter Communication is a concept of communicating between various Sub-Systems and CICS in a Multi- System environment

The term ‘Various Sub-Systems’ include other CICS regions in the same processor CICS region in other processors and even non-CICS regions

Inter Communication can be achieved in two ways... Multi Region Operation ( MRO ) Inter System Communication ( ISC )

Page 178: CICS Tutorial - HCL - Vijayanand M - 40145533

178

MULTI REGION OPERATION (MRO)

In any system, there could be more than one CICS region, each running independently under same OS say MVS/XA, on the same processor

Communication between CICS regions in the same environment under the same processor is termed as MRO

Page 179: CICS Tutorial - HCL - Vijayanand M - 40145533

179

MRO ExampleMultiple Departmental System

Accounting database

Inventorydatabase

Salesdatabase

AccountingSystem CICS 1

SalesSystem CICS 3

InventorySystem CICS 2

Operating SystemProcessor 1

Page 180: CICS Tutorial - HCL - Vijayanand M - 40145533

180

MULTI REGION OPERATION (MRO)

ADVANTAGES Functional Independence

Since operation of the CICS systems are independent of each other, the

owner can have total control over his system Reliability

Even if one system fails, other system(s) can support the functions of the failed system Performance Enhancement

System performance can be tuned independently for each system based on the relative

requirements and priority thus improving the overall efficiency Continued ...

Page 181: CICS Tutorial - HCL - Vijayanand M - 40145533

181

MULTI REGION OPERATION (MRO)

ADVANTAGES (cont.) Security

Systems being independent, greater security is achieved Non Redundant

Same data is shared by all the systems so there are no multiple copies Project Phasing

Since there are different systems present, the projects can be easily divided and developed individually

Continued ...

Page 182: CICS Tutorial - HCL - Vijayanand M - 40145533

182

MULTI REGION OPERATION (MRO)

Disadvantages

In MRO all operations must be centralized (more specifically in Uni.-Processor) and hence MRO is not suitable for distributed applications (Spanning several offices/ processors)

Page 183: CICS Tutorial - HCL - Vijayanand M - 40145533

183

Inter System Communication (ISC)

CICS in one processor can communicate with CICS in other processor or other non-CICS systems regardless of where they are physically located

ICS requires sophisticated communication network based on System Network Architecture (SNA)

which define protocol standards and data formats of communication by different hardware & software in multi-system environment

( SNA is protocol for IBM Mainframes to talk to other machines )

Page 184: CICS Tutorial - HCL - Vijayanand M - 40145533

184

Inter System Communication (ISC)

ADVANTAGES We can develop complex distributed systems relatively easily Transparency of Distance

Physically distant resources are shared through ISC

Hardware/Software IndependenceTo local CICS, it is transparent on

what hardware & software the remote system is existing on

Page 185: CICS Tutorial - HCL - Vijayanand M - 40145533

185

Typical example ISCDistributed Corporate System

Accounting database

Inventorydatabase

Salesdatabase

AccountingSystem CICS

Operating System

Processor 1Operating System

Processor 3

InventorySystem CICS

Operating System

Processor 2

SalesSystem CICS

CITY 1

CITY 3CITY 2

SNA

Page 186: CICS Tutorial - HCL - Vijayanand M - 40145533

186

SESSION # 11

Page 187: CICS Tutorial - HCL - Vijayanand M - 40145533

187

DEBUGGINGCICS EXECUTION DIAGNOSTIC FACILITY

( CEDF )

OBJECTIVES

To know more about diagnostic facilities in CICS

To learn to use CEDF

Page 188: CICS Tutorial - HCL - Vijayanand M - 40145533

188

DEBUGGING UTILITIES

Other CICS supplied debugging utilities include

Transaction Dump

Command Level Interpreter( CECI )

Temporary Storage Browse ( CEBR )

Master Terminal Transaction ( CEMT )

Dynamic File Open / Close ( DFOC )

Page 189: CICS Tutorial - HCL - Vijayanand M - 40145533

189

EXECUTION DIAGNOSTIC FACILITY (EDF) EDF is a CICS supplied diagnostic facility to debug CICS applications in IBM Mainframe environment Functions of EDF...

EDF manipulates a transaction by executing and suspending a task and displays the status at different points At any point of interruption, information about the values of EIB, program`s WS area mapping and application screens (current, previous and next) and many more can be obtained At any point EDF can be cancelled and normal functioning can be resumed

EDF is activated by entering CEDF Trans-id along with the transaction-id which has to debugged

Page 190: CICS Tutorial - HCL - Vijayanand M - 40145533

190

EFFICIENT CICS PROGRAMMING

SESSION # 12

Page 191: CICS Tutorial - HCL - Vijayanand M - 40145533

191

EFFICIENT CICS PROGRAMMING

OBJECTIVES

To get an introduction to develope efficient CICS applications

Page 192: CICS Tutorial - HCL - Vijayanand M - 40145533

192

EFFICIENT CICS PROGRAMMING

Considerations to be made while designing an ON - LINE application

Processing Requirements

Screen requirements

On-Line printing requirements

Continued ...

Page 193: CICS Tutorial - HCL - Vijayanand M - 40145533

193

EFFICIENT CICS PROGRAMMING

Considerations to be made while designing an ON - LINE application (cont.)

User Friendliness

System performance and Resource usage

System security, reliability and maintainability

Page 194: CICS Tutorial - HCL - Vijayanand M - 40145533

194

EFFICIENT CICS PROGRAMMING

Considerations to be made to improve System Performance

Instead of CSA, CWA, TWA, TCTUA use EIB informations TSQ with MAIN option COMMAREA option with RETURN, XCTL and LINK commands

Define variables in WS section rather using GETMAIN command

Use VSAM files instead of BDAM, ISAM and QSAM files

Continued ...

Page 195: CICS Tutorial - HCL - Vijayanand M - 40145533

195

EFFICIENT CICS PROGRAMMING

Considerations to be made to improve System Performance ( cont. )

Instead of MULTIMAP panel approach use MULTIPAGE maps and FREE Format

pages Instead of using

Extra Partition TDQ use VSAM / ESDS files Intra Partition TDQ use TSQ with MAIN option

Use Pseudo Conversation technique Use minimum required WS section Free all acquired resources, with EXCLUSIVE

control as soon as possible Modularize programs based on the functional unit

Continued ...

Page 196: CICS Tutorial - HCL - Vijayanand M - 40145533

196

EFFICIENT CICS PROGRAMMING

Considerations to be made to improve System Performance ( cont. )

Reduce traffic on the line where ever possible

While browsing files, avoid Multi Files Browsing

Learn to use GENERIC key option.

- END -- END -