application program design day3. 2 copyright © 2005, infosys technologies ltd er/corp/crs/tp01/003...
TRANSCRIPT
![Page 1: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/1.jpg)
Application Program DesignDay3
![Page 2: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/2.jpg)
2Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Objectives• Basic CICS programming
– Structure of a simple CICS embedded COBOL program– Not to be used COBOL verbs
• Program Control statements– EXEC Interface Block– Exception handling
• Creating a run-unit– Translation and options available– Compilation and options available– Linker options– Execution
• Testing and Debugging– Handle Abends– Native commands like CEMT, CECI, CEBR
![Page 3: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/3.jpg)
3Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Coding COBOL under CICS
• EXEC interface stubs
BMS Screens
(Presentation Layer)
COBOL – CICS program
(Business Layer)
BMS VTAM
![Page 4: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/4.jpg)
4Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Not to be used COBOL verbs
• File I/O statements like – CLOSE, DELETE, OPEN, READ, WRITE, REWRITE, START
• No File Section and Environment Division required
• Other statements like – ACCEPT Date/Day/Day-of-week/Time, MERGE, STOP RUN and GO
BACK.
![Page 5: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/5.jpg)
5Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Ex.WORKING-STORAGE SECTION. 01 WS-COMMAREA. 02 WS-FLAG PIC X(2). LINKAGE SECTION. 01 DFHCOMMAREA. 02 LK-FLAG PIC X(2).
Pseudo - conversational techniques• The most important thing is passing of data
between pseudo-conversational tasks.
• We can pass data via a COMMAREA
![Page 6: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/6.jpg)
6Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Pseudo - conversational techniques
Return Statements• RETURN -1
EXEC CICS RETURNEXEC CICS RETURN
END-EXEC.END-EXEC.
• RETURN -2EXEC CICS RETURNEXEC CICS RETURN
TRANSID (‘TN01’)TRANSID (‘TN01’)
END-EXEC.END-EXEC.
![Page 7: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/7.jpg)
7Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Pseudo - conversational techniques
Return Statements
• RETURN -3EXEC CICS RETURN
TRANSID (‘TN01’)
COMMAREA (WS-COMMAREA)
LENGTH (WS-COMMAREA-LEN)
END-EXEC.
• To get the data back from DFHCOMMAREA
MOVE DFHCOMMAREA TO COMMAREA-DATA.
![Page 8: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/8.jpg)
8Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Ex.PROCEDURE DIVISION. A000-MAIN-PARA. EXEC CICS HANDLE CONDITION END-EXEC. IF EIBCALEN = 0 ---------- ELSE PERFORM EVALUATE B000-AID-CHK-PARA ENDIF
Pseudo - conversational techniques
![Page 9: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/9.jpg)
9Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Ex.B000-AID-CHK-PARA. EVALUATE EIBAID WHEN DFHENTER --------------- WHEN DFHPF1 --------------- END-EVALUATE.
Pseudo - conversational techniques• EVALUATE your populated EIBAID.
![Page 10: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/10.jpg)
10Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
EXEC CICS ASKTIME [ABSTIME(data_area)]END-EXEC.
Useful CICS commands
EXEC CICS FORMATTIME ABSTIME(data_area) [YYDDD(data_area)] [YYMMDD(data_area)] [YYDDMM(data_area)] [DATESEP(data_value)] [TIME(data_area)] [TIMESEP(data_value)]END-EXEC.
EXEC CICS SYNCPOINTEND_EXEC.
![Page 11: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/11.jpg)
11Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Exception handling
• Expected CICS errors– Record not found
– Map fail
• Logical errors– Division by zero
– Transaction id error
– Illegal character in numeric field
• Hardware or system errors– Input/output error while accessing files
![Page 12: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/12.jpg)
12Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
CICS commands for exception handling
• To handle expected CICS errors– HANDLE CONDITION
– RESP
– The above errors can be ignore by using IGNORE CONDITION or NO HANDLE
• To handle logical fatal errors– HANDLE ABEND
![Page 13: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/13.jpg)
13Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
HANDLE and IGNORE condition• HANDLE CONDITION
EXEC CICS HANDLE CONDITION
LENGERR (LENGTH-ERR-PARA)
INVREQ (INVREQ-ERR-PARA)
DUPKEY (DUPKEY-ERR-PARA)
ERROR (GEN-ERR-PARA)
END-EXEC.
• IGNORE CONDITIONEXEC CICS IGNORE CONDITION
LENGERR
END-EXEC.
![Page 14: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/14.jpg)
14Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
NOHANDLE and HANDLE ABEND• NOHANDLE
EXEC CICS RECEIVE INTO (IN-DATA-BUF) LENGTH (20) NOHANDLEEND-EXEC.
EXEC CICS HANDLE ABEND LABEL (abend-handle-para)END-EXEC.
• HANDLE ABEND
![Page 15: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/15.jpg)
15Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
RESP code handlingWORKING-STORAGE SECTION.
01 WS-RCODE PIC S9(8) COMP.
---------
PROCEDURE DIVISION.
---------
EXEC CICS SEND
FROM (-----)
LENGTH (-----)
RESP (WS-RCODE)
END-EXEC.
IF WS-RCODE = DFHRESP (LENGERR)
PERFORM LENGTH-ERROR-PARA-0100.
![Page 16: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/16.jpg)
16Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Creating a run unit
• The CICS translator– Converting CICS code into the language in which rest of the program is
coded
– If EXEC SQL is used, additional steps to translate SQL s/ms and bind is required
– EXEC commands are translated to CALL s/ms
– One input SYSIN and 2 output SYSPUNCH and SYSPRINT
![Page 17: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/17.jpg)
17Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Creating a run unit contd.,• Compiler options
– AMODE(31), RMODE(ANY)
– Ex : //LINKEDIT EXEC PGM=HEWL, PARM='XREF,RMODE=ANY,AMODE=31'
– AMODE(24), RMODE(24)
– Ex : //LINKEDIT EXEC PGM=HEWL, PARM='XREF,RMODE=24,AMODE=24'
![Page 18: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/18.jpg)
18Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Compilation of Cobol-CICS programSOURCE CODE
TRANSLATOR TRANSLATOR LISTING
TRANSLATED SOURCE CODE
COMPILER COMPILER LISTING
OBJECT MODULE
LINKAGE EDITOR
LOAD MODULE
LINK EDIT LISTING
![Page 19: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/19.jpg)
19Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Testing and Debugging• Abend Control Commands
EXEC CICS HANDLE ABEND
PROGRAM (name)
LABEL (label)
CANCEL
RESET
END-EXEC
EXEC CICS ABEND
ABCODE(‘9999’)
END-EXEC
![Page 20: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/20.jpg)
20Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Native CICS Commands - Recap
• CESN – to sign on
• CESF – to sign off
• CECI – Command level Interpreter
• CEBR – Temporary Storage Browse
• CEMT – Enhanced Master Terminal
• CEDF – Execution Diagnostic facility
![Page 21: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/21.jpg)
21Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Step 1: Open a tso session.Step 2: Create a new PDS.Step 3: Code the following program in a new member.
CICS Hello World! Program Development
![Page 22: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/22.jpg)
22Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Step 4: Compile the program using the clist TRNGCICS
CICS Hello World! Program Development
![Page 23: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/23.jpg)
23Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Step1: Open an Client session for Mainframe, type CICS3 and hit ENTER key. Enter your User id and Password and press the Enter Key.
Execution of Hello World! Program
![Page 24: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/24.jpg)
24Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Step 2: You’ll find a blank screen as shown below. Type the transaction-id. To Sign off, use the transaction CESF
Execution of Hello World! Program
![Page 25: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/25.jpg)
25Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Step 5: Open a CICS Session.
Step 6: Install the program using the command
CEMT SET PROG(program-name) NEW.
Step 7: Associate a transaction-id with the program in PCT
Note that transaction-ids are unique in the system.
CICS Hello World! Program Development
![Page 26: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/26.jpg)
26Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Summary• What are the not to be used COBOL verbs?• What is used to store and retrieve information in
pseudo-conversational programs?• Ways of ending a task without ending the transaction• How do we know if the program has been entered for
the first time?• How do we know what key is pressed?• How do we do a commit or save changes in CICS?• Different ways of exception handling• How do we create a run unit in CICS?• What are the Native CICS commands?• Hello World Program (COBOL-CICS) development.
![Page 27: Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure](https://reader035.vdocument.in/reader035/viewer/2022062305/56649f4c5503460f94c6cebe/html5/thumbnails/27.jpg)
27Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/TP01/003 Version No: 1.0
Thank You!