Вы находитесь на странице: 1из 13

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)

By $riniv@s Cell: 9823242344 It is the on-line system used on Mainframe. CICS itself acts as an O/S under z/OS MVS. BATCH 1. 2. 3. 4. 5. There are back-end applications No user interaction No cics is used Access is fast Compile and execute using JCL 1. 2. 3. 4. 5. ON-LINE These are front-end applications. User interaction will be there. Access is slow Compile using JCL

6. 7. 8. 9.

Formatting, loading data into files & database, generating reports. COBOL+JCL+VSAM+DB2 excluding CICS Compilation and execution of Batch programs is done using JCL. No instant result.

6. 7. CICS is used it is Online application Instant result

If

Note: Files are databases cannot be used simultaneously in both online and batch region.

Task: Task is an Instant transaction.

Transaction: A transaction is a set of related task. (group of tasks) Cics Support Multi-tasking & Multi-threading Multitasking: Executing different programs simultaneously is called Multitasking. Multithreading: Simultaneous executing the same programs and different programs is called multithreading. Multitasking is sub-set of Multithreading. A transaction is identifying using 4 Character word called Trans-Id.

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344 Ways to Initiate a Cics Transaction: By specifying the Trans-id on the left top most corner of the cics screen. By using pseudo-conversational programming i.e. using RETURN command. By using XCTL and LINK commands. By using START command. By using ATI (Automatic Transaction Initiation)

System Control Tables:

Note: 1. Unlike batch, there will be only a single system define load library for an entire application. 2. Unlike batch, there will be only a single unique logical file name for a Physical file. PCT: It contains information about the transaction-id and associated program names and other details. PPT: It contains program name and the corresponding Load library in which the program load module is store. FCT: It contains the Logical file name and the corresponding Physical file name (LF & PF). Unless a file name is registered in FCT. It cannot be accessed by the online programs. RCT: It contains the DB2 Plan and Table names which the online programs need to access. TCT: It contains the Terminal IDs and the Application IDs which the terminals can access.

Process involved in executing a program : When transaction id is triggered cics first checks the PCT & if Transaction id exists picks the program id associated with it. The program id is then searched in PPT & if it exits the load module is picked from the corresponding load library and then the execution begins. If any files are to be accessed, then CICS checks the LF name in the FCT & if it exists, then allows the access of data from PF. If the program has DB2 statements then CICS checks the plan name and DB2 tables in RCT & if they exist allows access to DB2 data. Pseudo-conversation: In this programming once a task is executed the resource of the programs are released until the user response.

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

This is possible using RETURN command. EXEC CICS RETURN END-EXEC Return: when return command is executed control is passing to the calling program (main program) & if there is no calling program control is pass to cics. EXEC CICS RETURN TRANSID (TR01) END-EXEC If Trans id is specified along with RETURN command, the control is pass to cics, but still a link is maintain with the transaction id. Once the user responds the control is trigger the same transaction which invokes the same program execution. Notes: 1. Return command is used instead of Stop Run & Go back. 2. We cannot use the following COBOL statements in a cics program. DISPLAY, ACCEPT, OPEN, CLOSE, STOP RUN, SELECT 3. No files or file declaration must be code. COMMAREA: it is the communication area b/w online program and b/w screen and the programs. Till the program execution begins whatever data enter on the screen is held in COMMAREA. To know whether user has entered any data on the screen we use EIBCALEN EIBCALEN Exec interface block communication area length EIBCALEN: If EIBCALEN = 0 The user has not entered any text Else User has entered data End-if EIBCALEN holds the count of characters in the commarea. You can pass up to a Max of 32k data from commarea. To pass beyond 32k data we use queues. Every CICS program must have a linkage section with DFHCOMMAREA inside it as follows: LINKAGE SECTION. 01 DFHCOMMAREA PIC X(100). CICS Program Building: 1. Design the map 2. Code the BMS Macros for the map. 3. Compile the BMS Macros. 4. Design the program for the corresponding map. 5. Code the program 6. Compile the program 7. Run the program using transaction id.

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

Design the map (screen):

Code the BMS macros for the map: MAPST1 DFHMSD TYPE=&SYSPARM/MAP/DSECT, MODE=IN/OUT/INOUT, LANG=COBOL/PLI/ASM, x STORAGE=AUTO, TIOAPFX=YES CTRL= (FREEKB, FRSET) DFHMDI SIZE= (24, 80), LINE=1, COLUMN=1 DFHMDF INITIAL=ICICI, POS= (1, 38), LENGTH=5, ATTRB=ASKIP DFHMDF INITIAL= USER-ID, POS= (10, 31) DFHMDF POS= (10, 41), LENGTH=01, ATTRIB= (UNPROT, FSET, IC), COLOR=YELLOW DFHMDF POS= (10, 51), LENGTH=10, ATTRIB= ASKIP DFHMDF INITIAL=PASSWORD, POS= (11, 31), LENGTH=10, ATTRIB= ASKIP DFHMDF POS= (11, 41), LENGTH=10, ATTRIB= (UNPROT, FSET, DRK) DFHMDF POS= (11, 51), LENGTH=01, ATTRIB= PROT DFHMDF INITIAL=ENTER: LOGIN F5: REFRESH, POS= (20, 10), LENGTH=40, ATTRIB=ASKIP DFHMDF POS= (22, 10), LENGTH=50, ATTRIB= (ASKIP, BRT) DFHMSD TYPE=FINAL END x x x x x x x x x x x x x x x

MAP1

UID

PWD

ERRMSG MAPST1

BMS [BASIC MAPPING SUPPORT] BMS Macros are used to build a map. BMS macros are divided into 3 types. 1. DFHMSD 2. DFHMDI 3. DFHMDF DFHMSD: [Defined field Hierarchy map set definition] It is used to define the Mapset. Mapset is a collection of related Maps. DFHMDI: [Defined field Hierarchy map definition interpreter] It is used to define the map.

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

DFHMDF: [Defined field Hierarchy definition field] It is used to define the fields. Physical Map: It is the load-module generated after compiling the BMS macros which is used to display the map on the monitor screen. Symbolic Map: It is the copy-book generated after compiling BMS macros. These fields are (fields in the symbolic map) used to send & receive data from screen to program and program to screen. Type : It specifies the type of the map to be generated. 1. Type=Map will generate only a Physical Map. 2. Type=DESECT will generate only a symbolic map. 3. Type=&sysparm will generate both physical and symbolic maps. It specifies the usage type of the map. MODE=IN will enable the map only to be used for input purpose. MODE=OUT the map is used only for output purpose. MODE=INOUT the map can be used for both inout purpose. It specifies the programming language with which the map will be used. STORAGE=AUTO is specified system will allocate separate memory for each map in the mapset. STORAGE=AUTO is not specified, and then overlapping of maps occurs. [Terminal input output area prefix] till the program execution begins the control information (Function Keys) of the screen is held in TIOA. When, TIOAFX=YES is specified then a 12 byte filler is generated to store the control information. TIOAFX=NO is specified then a 12 byte filler is not generated to store the control information. CTRL=FREEKB It frees the key-board before the map is displayed on the screen. It indicates the size of the map. It specifies the starting line of the map It specifies the starting column of the map. It is used to specify a pre-defined text to be displayed on the screen It tells the position of the screen POS= (LL, CC) It specifies the length of the Field It specifies the attribute (characteristics of a field) ATTRIB= ASKIP It will skip the control over the field, not allowing user to modify the field. PROT (protect) the control stops at the field, but doesnt allow user to modify the field or enter data. UNPROT the control stops at the field and allows user to modify the field IC (insert cursor) it will position the cursor at a desired field. If IC is specified at more than one field the cursor is positioned at the last unprotected field. If no IC is specified then the cursor is position at the first byte on the screen. DRK It darkens the field making it invisible to the user. BRT It brightens the field.

MODE

LANG

STORAGE:

TIOAFX :

CTRL SIZE LINE

: : :

COLUMN : INITIAL : POS :

LENGTH : ATTRIB :

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

COPY-BOOK: 01 MAP1I. 03 FILLER PIC X(12). 03 UIDL PIC S9(04) COMP. 03 UIDF PIC X(01). 03 FILLER REDEFINES UIDF. 05 UIDA PIC X(01). 03 UIDI PIC X(10). 03 PWDL PIC S9(09) COMP. 03 FILLER REDEFINES PWDF. 05 PWDA PIC X(01). 03 PWDI PIC X(10). 03 ERRMSGL PIC S9(04) COMP. 03 ERRMSGF PIC X(01). 03 FILLER REDEFINES ERRMSGF. 05 ERRMSGA PIC X(01). 03 ERRMSGI PIC X(40). 01 MAP10 REDEFINES MAP1I. 03 FILLER PIC X(12). 03 FILLER PIC X(03). 03 UIDO PIC X(10). 03 FILLER PIC X(03). 03 PWDO PIC X(10). 03 FILLER PIC X(03). 03 ERRMSGO PIC X(40). UIDL-Length field is used to store a length of the data enter by user UIDA-Attribute field is used to store the characteristics of a field like ASKIP, UNPRT, PRT, BRT etc. UIDF-Flag field is used to set the MDT to ON/OFF. UIDI-Input field is used to pass data from screen to program. UIDO-Output field is used to pass data from program to screen.

In the above example Address1 fields MDT must be set to 0 (zero) (off), since it is a mandatory field & when user enter the data, then MDT must 1 (on). For address2&3 which are optional fields. FSET must be specified to always set the MDT to 1. Then ever the user enter or doesnt enter the field can be received into the program. FRSET: when FRSET is specified the MDT for all the fields in all maps in the Mapset will be set to 0 (off). FSET: When FSET is specified for a field, then its MDT is set to 1. MDT: It is Modified Data Tag. It is the 7th bit in the flag-type, which has values 0 zero for OFF, 1 one for ON. Here 0 indicates field is not modified & 1 indicates field is modified.

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

Note: If FRSET & FSET are specified both, then FSET is overwrite FRSET. Pseudo code for Login screen 1. Send the login screen to the user. 2. Receive the input from the screen. 3. Evaluate the function key pressed. When Enter key is pressed Validate the User-Id and Password entered by user with that of AUTH_TBL. If valid Pass the control to page-2. Else If invalid Thrown an error message Invalid user-id/password To ERRMSGO. Resend Map1. End-if. When F5 key is pressed Move low-values to UIDO, PWDO and ERRMSGO Resend Map1. End-evaluate. SEND:- To send both Physical and symbolic maps: EXEC CICS SEND MAP (MAP1) MAPSET (MAPST1) FROM (MAP10) ERASE/ERASEUP ALARAM END-EXEC. ERASE will clear the monitor screen before sending the map. ERASEUP will clear the un-protected fields before sending the map. ALARM gives a beep sound once the maps is displayed. To send only Physical map: EXEC CICS SEND MAP (MAP1) MAPSET (MAPST1) MAPONLY

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

END-EXEC. It will close all the unprotected fields before sending the Map. To send only Symbolic map: EXEC CICS SEND MAP (MAP1) MAPSET (MAPST1) DATA ONLY END-EXEC. Data only will send only the Symbolic map. Map only will send only in the Physical map. Arrays: - It will clear the screen before the sending map. RECEIVE: It is used to receive only those fields whose MDT is set to 1. So any of the fields MDT is still zero it will through an APPEND with the message MAPFAIL. XCTL: - It is used to pass the control to a program completely at the same level. Here control is not expected to return.

(Here execute it & goes to PGM-B)

(Here execute the control & goes to CICS)

LINK: - It is used to pass control to a program at a lower level. Here control is expected to return back. Where the control returns to where it has been passed from it continuous execution from the statement after LINK command.

(Here executes, it goes to CICS)

(Here after execute, the ctrl goes to (LINK) again it goes under the prog)

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

XCTL EXEC CICS XCTL PROGRAM (PROG3) COMMAREA (WS-COMMAREA) END-EXEC. CURSOR positioning techniques: 1. Static cursor positioning. 2. Dynamic cursor positioning. 3. Relative cursor positioning. Static cursor positioning: statically we can set the cursor positioning at a desired field using IC. UID DFHMDF ATTRIB=(IC) Note: 1. If IC is specified for more than one field, the cursor will be positioned at the last unprotected and IC specify field. If IC is specified then cursor will be position at the first byte in the Map. SYSTEM DEFINED CICS TRANSACTIONS: CEDA (CICS Execution Dynamic Allocation): Defining & Installing Transaction ID: CEDA DEF TRANS(TR01) GROUP(ICZ20SAB) CEDA UBS TRABS(TR01) GROUP(ICZ20SAB) Group specifies the group-id for an application. So the TRANS-ID of one group-id can also be used for other groups. Define will check whether the same TRANS-ID is already there with in the group. Install will update the TRANS-ID, program names, file names, etc. in the system control tables. Once define is successful then only we can install. Define & Install program. CEDA DEF PROG(PROGA) TRANS(TR01) GROUP(ICZ20SAB) CEDA INS PROG(PROGA) TRANS(TR01) GROUP(ICZ20SAB) CEMT (CICS Execution Master Terminal) 1. To move Load-Module from Batch to Online:

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

CEMT SET PROGRAM(MAPST1) NEWCOPY CEMT SET PROGRAM(PROGA) NEWCOPY Where NEWCOPY/NEWC/NEW is used to override the existing version of load-module in cics region. Note: We use file in the batch region if it is closed and disable in CICS. We can open an enable file in CICS region only when it is available in batch. 2. To find the corresponding program name for a TRANS-ID CEMT I TRANS(TR01) 3. To find the TRANS-ID for a program CEMT I PROG(PROGA) TRANS 4. To find a physical filename for a logical file CEMT I FILE(ACCT-FILE)---------------- (this is logical file) (press enter) ICZ20SAB.ACCTS.FILE ------- (this is physical file) CECI (CICS Execution Command Interpretation) To display the map in CICS without a program CECI SEND MAP(MAP2) MAPSET(MAPST1) CEDF (CICS Execution Diagnostic Facility) CEDF is used to debug online programs it shows the execution of CICS commands b/w two tasks. CEBR (CICS Execution Browse) It is used to Browse QUEUE data. CESN (CICS Execution Sign on) It will prompt the user to enter user-id & password to LOGON to CICS. CESF (CICS Execution Sign off) It wills logoff a user from CICS READING DATA FROM FILE: SEQUENTIAL ACCESS: MOVE LOW-VALUES TO ACCT-NUM EXEC CICS STARTBR FILE (ACCT-FILE) RIDFLD (ACCT-NUM) KEYLEN (0) END-EXEC. PERFORM UNTIL WS-EOF = Y EXEC-CICS CURSOR AT 0 POSITION

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

STARTBR

FILE (ACCT-FILE)

RIDFLD (ACCT-NUM) INTO (ACCT-REC) LENGTH (122) END-EXEC. START BR: It will place the cursor at the desired record based on RIDFLD & also key length must be specified as 0(zero). END BR: It will end the access on file by the program. READ NEXT: It reads next record in the forward direction READ PREV: It will read the records in reverse direction. RIDFLD: It specifies the key-field value of the desired record, which is searched in the key-field of the file. LENGTH: It specifies the length of the record. INTO: It specifies the record name into which a record data from system memory is retrieved (stored). GENERIC: If the purpose of Read statement is just to Fetch the data, then GENERIC is specified (default). UPDATE: If the record Read is to be modified, then update is to be specified. Then only we can use re-write operations. READ: MOVE A162 TO ACCT-NUM EXEC-CICS READ FILE (ACCT-FILE) RLDFLD (ACCT-NUM) LENGTH (122) INTO (ACCT-REC) GENERIC/UPDATE END-EXEC. MODIFY A RECORD: MOVE A162 TO ACCT-NUM . . . MOVE 9823242344 TO ACCT-HLDR-NUM EXEC-CICS READ FILE (ACCT-FILE)

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

FROM (ACCT-REC) RLDFLD (ACCT-NUM) END-EXEC. DELETE A RECORD: MOVE A162 TO ACCT-NUM EXEC-CICS DELETE FILE (ACCT-FILE) RLDFLD (ACCT-NUM) END-EXEC.

ERROR HANDLING: HANDLE CONDITION: EXEC-CICS HANDLE CONDITION NOT OPEN(9999-ERROR-PROGRAM) NOTFND( ) LENERR( ) END-EXEC.

EXEC-CICS XCTL PROGRAM(PROG3) END-EXEC. EXEC-CICS HANDLE CONDITION PGMIDERR( ) END-EXEC.

NOT OPEN It specifies file is not opened in CICS NOT FOUND Desired record not found LENERR Specified length of the record is incorrect. PGMIDERR Program-id specified is not found in PPT table. MAP FAIL Map name specified is not registered in PPT, while executing receive command, any of the fields MDT is zero END FILE: It specifies the end of the file. RESP: It specifies the response code of the CICS command. EIB: (Execution Interface Block) it captures the user response. EIBCALN: It tells whether user has enter data or not. EIBAID: It captures the user pressed Function Key. EIBRESP: It captures the response code of CICS command. QUEUES:

CICS (CUSTOMER INFORMATION CONTROL SYSTEM)


By $riniv@s Cell: 9823242344

It is a storage area similar to a file. Where queue records are stored. Queues are used to store data and use it by n no. of characters. A queue is identifying using QID, which is of 8 char long. There are two types of queues TSQ and TDQ. TSQ can be used as scratch pad in main memory. You can write as much as you want in TSQ and they will be available to all the transactions that are aware of the queue name. TSQ is primarily used to share huge amount of information across the transactions. Refer Queues section for more details. 1. Temporary storage queue (TSQ) 2. Transient data queue (TDQ)

Temporary storage queue (TSQ) 1. Queue records are stored based on item no. 2. Queue records can be read any no of times 3. To delete queue records, you have to delete the queue itself. 4. TSQs are registered in TST (Temporary storage Table). WRITING DATA INTO QUEUE EXEC CICS WRITE Q TS QUEUE(QID001) ITEM(WS-ITEM-NUM) FROM(WS-TSQ-DATA) END-EXEC RECORDING DATA FORM A QUEUE: MOVE 3 TO WS-ITEM-NUM EXEC CICS READQ TS QUEUE(QID001) ITEM(WS-ITEM-NUM) INTO(WS-TSQ-DATA) END-EXEC Data can be access sequentially or randomly DELETING A QUEUE END-EXEC DELETE Q TS QUEUE(QID001) EXEC CICS

1. 2. 3. 4.

Transient data queue (TDQ) Queue records are stored without item no. Queue records can be read only once. Once the record is delete, it gets deleted. TDQs must be registered in DCT (destination control table).

EXEC CICS WRITE Q TD QUEUE(QID001) FROM(WS-TSQ-DATA) END-EXEC

EXEC CICS READQ TS QUEUE(QID001) INTO(WS-TSQ-DATA) END-EXEC

Data can be access only sequentially.

Вам также может понравиться