700 likes | 914 Views
INTRODUCTION TO CICS Pavani D Feb 23, 2007. OBJECTIVES. · Batch & Online systems · Why CICS? · CICS System components · CICS control program & tables · CICS startup and shutdown. BATCH & ONLINE SYSTEM.
E N D
INTRODUCTION TO CICS Pavani D Feb 23, 2007 |
OBJECTIVES ·Batch & Online systems ·Why CICS? ·CICS System components ·CICS control program & tables ·CICS startup and shutdown |
BATCH & ONLINE SYSTEM • ONLINE processing allows a user to interact with a computer and access its resources via a terminal • Example : Railway Reservation system |
WHAT IS CICS? ·Customer Information Control System (CICS) was developed in 1960 by IBM · It is one of the Original ONLINE TRANSACTION PROCESSING(OLTP) managers · General purpose data base / data communication (DB/DC) control system · Provides services to handle all the special requirements for online processing |
Operating System (MVS/XA) Other Database Database Telecommunication Systems Access Method Access method Method (VSAM/ (VTAM,TCAM, (DL/I, DB@) BDAM) BTAM) Data Storage Terminals CICS / MVS ROLE OF CICS • Role of CICS is to interface between application programs and the DB/DC control system. |
CICS CONTROL PROGRAM AND TABLES · CICS CONTROL PROGRAM (IBM SUPPLIED) ·FCP (FILE CONTROL PROGRAM) · JCP (JOURNAL CONTROL PROGRAM) · KCP (TASK CONTROL PROGRAM) · PCP (PROGRAM CONTROL PROGRAM) · SCP (STORAGE CONTROL PROGRAM) · TCP (TERMINAL CONTROL PROGRAM) · TDP (TRANSIENT DATA PROGRAM) · TSP (TEMPORARY STORAGE PROGRAM) OTHERS |
CICS CONTROL PROGRAM AND TABLES - Contd… · CICS CONTROL TABLES (USER SPECIFIED) · FCT (FILE CONTROL TABLE) · JCT (JOURNAL CONTROL TABLE) · PCT (PROGRAM CONTROL TABLE) · PPT (PROCESSING PROGRAM TABLE) · TCT (TERMINAL CONTROL TABLE) · DCT (DESTINATION CONTROL TABLE) · TST (TEMPORARY STORAGE TABLE) |
CICS START UP • CICS is submitted as a batch job. • CICS System Initialization program (SIP) is the main job step • SIP loads System Initialization Table (SIT) • SIP further loads all control programs and tables • Perform initial housekeeping tasks |
CICS SHUTDOWN • Master terminal transaction is entered with shutdown option • CICS job produces various logs, statistics, dumps and other reports and ends • No transaction can be executed after the CICS job is brought down. |
ROLE OF CICS • MULTI TASKING - More than one task can be executed concurrently. • MULTI THREADING - Tasks share the same program under the multi tasking environment. • RE-ENTRANT PROGRAM - Program which does not modify itself in any way during execution. • QUASI RE-ENTRANT - Is a reentrant program under the CICS environment. |
STRUCTURE OF CICS APPLICATION PROGRAM Identification Division Program - ID required ·Other comments as below, are optional but recommended - Author - Date-Written - Date-compiled - Remarks Environment Division - Only header is required |
STRUCTURE OF CICS APPLICATION PROGRAM - Contd… • The following COBOL statements are prohibited. • ACCEPT, CURRENT-DATE, DATE, DAY, DISPLAY, EXHIBIT, STOP RUN, TRACE • Any I/O Statements(OPEN, CLOSE, READ, WRITE, REWRITE, DELETE, START) • REPORT WRITER feature • SORT feature • CALL statement is allowed if the called program does not issue any CICS commands or inhibited COBOL statements mentioned above. |
TERMINATION STATEMENTS ·STOP RUN in COBOL uses operating system facilities, and therefore, is discouraged. · EXIT program is ignored if the program has not been called. ·CICS RETURN COMMAND and/or GOBACK statement is recommended. |
IMPORTANT DEFINITIONS ·Transactions An exchange between a terminal and a data base representing an application process. For example, an inquiry or a deposit and balance update ·Task A specific instance of a transaction i.e. a unique unit of work. ·Program Prepared statements compiled or assembled into an executable module of machine instructions. |
CONVERSATIONAL TRANSACTION ·Program uses a pair of SEND and RECEIVE commands. ·Program waits until the user responds. ·Resources are held until the user responds. · Very inefficient way of conversing with the user. |
PSEUDO CONVERSATIONAL TRANSACTION ·The task is terminated after a message is sent with a linkage for the next task. CICS provides a facility (COMMAREA) to made it easier to accomplish this. ·When the user completes response (by pressing enter) reset task is automatically initiated by CICS. ·The task receives the message from the terminal & processes it. · This is a multitask operation from system's point of view. |
PROGRAM PREPARATION Contd… ·TRANSLATOR - The translator recognizes EXEC CICS and EXEC DLI statements. They are commented out and replaced with statements in the appropriate language. Here, COBOL MOVE instructions and a CALL are inserted and passed on to the COBOL compiler. ·DB2 Precompiler - The DB2 precompiler is supplied by the relational data base managers, DB2 and SQL/DS. It recognizes EXEC SQL statements which it will comment out and replace with in our case. COBOL PERFORM and CALL statements. |
PROGRAM PREPARATION Contd… ·Output of the transaction is i/p to the compiler ·The o/p of the linkage editor is executable. The load module is placed in the CICS online program library. • Messages or warnings are provided on all the listings. The compiler listing is or limited use if the translator listing would not process all commands. |
TESTING CEMT set program (prg1) New comp Or CEMT S PR (prg1) N ·After making changes to a program the new version replaces old version, but CICS which is currently executing has no way of knowing this automatically. The CICS processing program table PPT still points to the old-version. ·To avoid testing with the old version, you must use the CICS-provided CEMT transaction to update the pointer to the program. |
COMMON FORMAT ·A CICS command consists of a keyword phrase, delimiter, function, options and their argument values. ·Be careful about periods. Avoid them after END-EXEC. ·The translator will place a period into the generated code if a period follows end-exec. |
ARGUMENT VALUES data - value PIC S9(4) comp Halfword binary IC S9(8) comp Fullword binary PIC X(15) character string constants permitted data - area COBOL data name eg :- 01 Record-area. 05 Fld 1 05 Fld 2 name COBOL data name Character string label Paragraph name hhmmss PIC S9(7) comp 3 Packed decimal pointer-ref BLL cell Usage pointer |
RECEIVE COMMAND ·EXEC CICS RECEIVE INTO (data area) LENGTH(ml) END-EXEC - RECEIVE command is used to receive incoming data from the terminal to which this CICS transaction is associated. - A receiving area must be defined in working storage section and has to be specified in the INTO parameter. - Length field must be defined in working storage section as a S9(4) comp. It has to be specified in length option. |
SEND COMMAND ·EXEC CICS SEND FROM (data area) LENGTH(ln) END-EXEC -The data to be sent must be stored in working storage section, and this field name has to be specified in the FROM parameter. - Length must be specified the same as that of the Receive command. |
EXCEPTIONAL CONDITIONS ·RESP option - Define a full word binary field S9(8) comp in the working storage section as the response field. - Place RESP option with the response field in any CICS command. -After command execution, check the response code in the response field with DFHRESP (xxxx) where xxxx is - NORMAL for normal completion Or - Any exceptional condition |
HANDLE CONDITION ·Handle condition command is used to transfer control to the procedure label specified if the exceptional condition, specified occurs. · Remains active until the end of program or another handle condition request overrides it. |
IGNORE CONDITION ·Ignore condition command causes no action to be taken if the condition specified occurs in the programs. ·Request by the IGNORE CONDITION command is valid until the subsequent HANDLE CONDITION command for the same condition. |
NO HANDLE OPTION • ·If NOHANDLE option is specified in any CICS command, no action will be taken for any exceptional condition occurring during execution of this command. Eg : EXEC CICS SEND From (...) Length (...) NOHANDLE END-EXEC |
FORMATTING TIME AND DATE ·ASKTIME Command - Used to request the current date and time - EIBDATE and EIBTIME fields have the values at the task initiation time. ·FORMAT EXEC CICS ASKTIME END-EXEC |
FORMAT TIME COMMAND - used to receive the information of data and time in various formats. - Format [YYDDD (data - area)] [YYMMDD (data - area)] [YYDDMM (data - area)] [MMDDYY (data - area)] [DDMMYY (data - area)] [DATESEP(data - value)] [DAY OF WEEK (data - area)] [DAY OF MONTH (data - area)] [MONTH OF YEAR (data - area)] [YEAR (data - area)] [TIME (data - area)] [TIMESEP (data - value)] |
FORMAT TIME COMMAND Contd… - DATESEP represents data separator (default is "/"). - TIMESEP represents time separator (default is ":"). - The data area for the ABSTIME option of ASKTIME and FORMATTIME commands must be a 15-digit packed decimal data type. |
DELAY COMMAND ·DELAY command - used to delay the processing of a task for the specified time interval or until the specified time. FORMAT EXEC CICS DELAY INTERVAL (002000) TIME (152000) End – EXEC - Task will be suspended for 20 minutes if INTERVAL is specified or until 15:20:00 if TIME is specified. |
READING EXTERNAL DATA - OBJECTIVE DIRECT RETRIEVAL - VSAM DATA STRUCTURES - RELATIONAL TABLE ROW BROWSE - VSAM DATA STRUCTURE - RELATIONAL TABLE ROWS |
FUNCTIONAL OVERVIEW contd… Entry for VSAM file has to be there in FCT (File Control Table) · Each entry contains all descriptive information for the file it represents. So, programmer need not define the physical organization and other attributes of the files. - The File parameter coded in the program must be the same as the file name in the FCT. - Interface between CICS and Relational Database is called CICS attachment Facility. Statement are coded in SQL language in the application program to Communicate data requests to the database. |
VSAM DATA STRUCTURES · CICS uses the following VSAM structures - Key sequenced data set (KSDS) - Entry sequenced dataset (ESDS) - Relative record dataset (RRDS) |
PROGRAM ORGANIZATION · File attributes are defined in the FCT for each file Files are opened by CICS - Immediately after system initialization if specified in the FCT. - In response to a file access request from an application if the file is closed - In response to a master terminal CEMT request from an operation. Application program is not responsible for open / close of files |
RECORD IDENTIFICATION · RECORD KEY · RELATIVE BYTE ADDRESS · RELATIVE RECORD NUMBER · PARTIAL KEY - key of the record to be read is specified in the RIDFLD. for KSDS - Key specified can be a full key or partial key - If partial key, key length has to be provided - RBA (Relative Byte Address) - Can also be used instead of actual key value · For ESDS - RIDFLD contain a 4 byte RBA · For RRDS - RIDFLD contains 4 Byte binary relative record number. |
READ COMMAND · READ command with INTO Option. (FULL KEY) - Reads the record specified by the full key. - The data content of the record is moved into the specified data-area defined in the working storage section. FORMAT EXEC CICS READ DATASET (name) | FILE (name) INTO (data-area) | SET(ptr-ref) RIDFLD (data-area) [ LENGTH (data-values) ] END - EXEC. - DATASET / FILE names the file and must be defined in FCT. - INTO names the field in the working storage section where the data has to be placed. - RIDFLD is the key field. - LENGTH is half word binary. It indicates maximum length of the record to be read. It is optional. |
EXCEPTIONAL CONDITIONS DUPKEY : If duplicate record is found for the specified key. NOTFND : If the record is not found for the key specified. LENGERR : The specified length (in LENGTH OPTION) is shorter than the actual record length. NOTOPEN : When file specified is not open. |
READ · READ command with GENERIC OPTION Used to read a nonspecific record based on the generic key. (i.e. higher part of key) specified, instead of full key. EXEC CICS READ FILE (‘FILEAAA’) INTO (FILE-IOAREA) RIDFLD (REC-KEY) KEYLENGTH (3) GENERIC LENGTH (WS-LEN) END-EXEC - KEY LENGTH specifies length of Generic key. |
EXAMPLE MOVE 50 TO WS - LEN MOVE ‘BAG’ TO REC - KEY. EXEC CICS READ DATASET (‘FILEAAA’) INTO (data-area) RIDFLD (REC-KEY) KEYLENGTH (3) GENERIC LENGTH (WS-LEN) END-EXEC. DATA IN FILE ARG 112 ARG 111 BAG 110 This record will be read as this is the first record with key BAG BAG 112 TRG 111 EXCEPTIONAL condition : INVREQ: Key length specified is greater than the actual key length of the record |
READ COMMAND · READ command with GTEQ option - Used to read a non-specific record whose key is equal to or greater than the full key data specified. EXEC CICS READ FILE (‘FILEAAA’) INTO (data-area) RIDFLD (REC-KEY) GTEQ <---- Greater than or equal to search LENGTH (WS-LEN) END - EXEC. |
BROWSE · BROWSE - VSAM FILE RECORDS - Establish position - Retrieve and process records - Terminate browse · Record retrieved as a part of browse cannot be updated during browse. |
STARTBR • · STARTBR COMMAND - to establish starting position for a file EXEC CICS STARTBR FILE (name) RIDFLD (data-area) GTEQ END-EXEC. GTEQ If no record is found for exact key, CICS places position to next available record EQUAL If no record is found for the exact key, exceptional condition NOTFND occurs GENERIC Places the position at the first record of partial key Exceptional conditions. · DSIDERR : File specified is not found in FCT. NOTFND : Specified Record is not found |
READNEXT • · READNEXT command - Ued to read a record of a file sequentially forward - STARTBR must be successfully completed before READNEXT command EXEC CICS READNEXT FILE (name) | DATASET(name) INTO (data_area) LENGTH (data_value) RIDFLD (data_area) END-EXEC. Exceptional Conditions – DUPKEY : If Duplicate record is found for key specified. ENDFILE : End of file detected. LENGERR: Actual record length greater than the length specified |
READPREV READPREV command - Used to read a record of a file sequentially backward - STARTBR must have been successfully completed before READPREV command Options and parameters are same as READNEXT command Exceptional Conditions NOTFND: If no record is found for key specified INVREQ: Generic option must not be used in the STARTBR command prior to READPREV command if used, this condition occur. |