SEND MAP program IDENTIFICATION DIVISION. PROGRAM-ID. ADDPGM1. ENVIRONMENT DIVISION. ...
IDENTIFICATION DIVISION.
PROGRAM-ID. ADDPGM1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NUM1 PIC 9(3).
77 WS-NUM2 PIC 9(3).
77 WS-RESU PIC 9(4).
77 WS-LEN PIC S9(4) COMP.
COPY DFHAID.
COPY DFHBMSCA.
COPY ADDSET1.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO ADDMAP1I.
MOVE LOW-VALUES TO ADDMAP1O.
EXEC CICS
SEND MAP('ADDMAP1')
MAPSET('ADDSET1')
ERASE
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
Addition of two numbers
IDENTIFICATION DIVISION.
PROGRAM-ID. ADDPGM1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NUM1 PIC 9(3).
77 WS-NUM2 PIC 9(3).
77 WS-RESU PIC 9(4).
77 WS-LEN PIC S9(4) COMP.
COPY DFHAID.
COPY DFHBMSCA.
COPY ADDSET1.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO ADDMAP1I.
MOVE LOW-VALUES TO ADDMAP1O.
EXEC CICS
SEND MAP('ADDMAP1')
MAPSET('ADDSET1')
ERASE
END-EXEC.
MOVE -30 TO WS-LEN.
EXEC CICS RECEIVE
MAP('ADDMAP1')
MAPSET('ADDSET1')
INTO(ADDMAP1I)
END-EXEC.
MOVE NUM1I TO WS-NUM1.
MOVE NUM2I TO WS-NUM2.
COMPUTE WS-RESU = WS-NUM1 + WS-NUM2.
MOVE WS-RESU TO RESUO.
MOVE 200 TO WS-LEN.
EXEC CICS
SEND MAP('ADDMAP1')
MAPSET('ADDSET1')
FROM(ADDMAP1O)
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
Write a record to a dataset
IDENTIFICATION DIVISION.
PROGRAM-ID. EMPWRI1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 STU-REC.
05 STU-NO PIC 9(4).
05 STU-NAME PIC X(20).
05 STU-ADDR PIC X(20).
COPY DFHAID.
COPY DFHBMSCA.
COPY STUSET1.
77 WS-LEN PIC S9(4) COMP.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO STUMAP1I.
MOVE LOW-VALUES TO STUMAP1O.
EXEC CICS SEND
MAP('STUMAP1')
MAPSET('STUSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('STUMAP1')
MAPSET('STUSET1')
INTO(STUMAP1I)
END-EXEC.
MOVE SNOI TO STU-NO.
MOVE SNAMEI TO STU-NAME.
MOVE SADDRI TO STU-ADDR.
MOVE 44 TO WS-LEN.
EXEC CICS WRITE
DATASET('VINSTUKS')
FROM(STU-REC)
RIDFLD(STU-NO)
LENGTH(WS-LEN)
END-EXEC.
MOVE 'WRITE SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('STUMAP1')
MAPSET('STUSET1')
FROM(STUMAP1O)
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
Read a Record from file and Delete
IDENTIFICATION DIVISION.
PROGRAM-ID. INDDELT.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 EMP-REC.
05 EMP-NO PIC 9(4).
05 EMP-NAME PIC X(10).
05 EMP-ADDR PIC X(10).
COPY DFHAID.
COPY DFHBMSCA.
COPY EMPSET1.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO EMPMAP1I.
MOVE LOW-VALUES TO EMPMAP1O.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
EXEC CICS READ
DATASET('INDFILE')
INTO(EMP-REC)
RIDFLD(EMP-NO)
UPDATE
END-EXEC.
MOVE EMP-NO TO ENOO.
MOVE EMP-NAME TO ENAMO.
MOVE EMP-ADDR TO EADDRO.
MOVE 'READ SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
FROM(EMPMAP1O)
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
MOVE ENAMI TO EMP-NAME.
MOVE EADDRI TO EMP-ADDR.
EXEC CICS DELETE
DATASET('INDFILE')
END-EXEC.
MOVE 'DELETE SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
Read a single record from a file
IDENTIFICATION DIVISION.
PROGRAM-ID. INDREAD.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-RCODE PIC S9(8) COMP.
01 EMP-REC.
05 EMP-NO PIC 9(4).
05 EMP-NAME PIC X(10).
05 EMP-ADDR PIC X(10).
COPY DFHAID.
COPY DFHBMSCA.
COPY EMPSET1.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO EMPMAP1I.
MOVE LOW-VALUES TO EMPMAP1O.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
EXEC CICS READ
DATASET('INDFILE')
INTO(EMP-REC)
RIDFLD(EMP-NO)
END-EXEC.
MOVE EMP-NO TO ENOO.
MOVE EMP-NAME TO ENAMO.
MOVE EMP-ADDR TO EADDRO.
MOVE 'READ SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
FROM(EMPMAP1O)
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
REWRITE File program
IDENTIFICATION DIVISION.
PROGRAM-ID. INDUPDT.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 EMP-REC.
05 EMP-NO PIC 9(4).
05 EMP-NAME PIC X(10).
05 EMP-ADDR PIC X(10).
COPY DFHAID.
COPY DFHBMSCA.
COPY EMPSET1.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO EMPMAP1I.
MOVE LOW-VALUES TO EMPMAP1O.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
EXEC CICS READ
DATASET('INDFILE')
INTO(EMP-REC)
RIDFLD(EMP-NO)
UPDATE
END-EXEC.
MOVE EMP-NO TO ENOO.
MOVE EMP-NAME TO ENAMO.
MOVE EMP-ADDR TO EADDRO.
MOVE 'READ SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
FROM(EMPMAP1O)
ERASE
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
MOVE ENAMI TO EMP-NAME.
MOVE EADDRI TO EMP-ADDR.
EXEC CICS REWRITE
DATASET('INDFILE')
FROM(EMP-REC)
END-EXEC.
MOVE 'REWRITE SUCCESSFUL' TO MSGO.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
Insert a ROW into a table
IDENTIFICATION DIVISION.
PROGRAM-ID. INSEMP.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE EMPCPY
END-EXEC.
77 WS-SQLCODE PIC S9(9) SIGN LEADING SEPARATE CHARACTER.00120010
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
COPY DFHAID.
COPY DFHBMSCA.
COPY EMPSET1.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO EMPMAP1I.
MOVE LOW-VALUES TO EMPMAP1O.
EXEC CICS SEND MAP('EMPMAP1')
MAPSET('EMPSET1')
ERASE
END-EXEC.
MOVE 44 TO WS-LEN.
CICS RECEIVE MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE EIDI TO HS-ENO.
MOVE ENAMEI TO HS-ENAME.
MOVE EADDRI TO HS-EADDR.
EXEC SQL
INSERT INTO EMP
(ENO,ENAME,
EADDR)
VALUES(:HS-ENO,
:HS-ENAME,
:HS-EADDR)
END-EXEC.
IF SQLCODE = 0
MOVE 'INSERT SUCCESSFUL' TO MSGO
PERFORM SEND-PARA
ELSE
MOVE SQLCODE TO WS-SQLCODE
MOVE WS-SQLCODE TO MSGO
PERFORM SEND-PARA
END-IF.
SEND-PARA.
EXEC CICS SEND MAP('EMPMAP1')
MAPSET('EMPSET1')
FROM(EMPMAP1O)
END-EXEC.
EXEC CICS RETURN
END-EXEC.
Delete a row from the table
IDENTIFICATION DIVISION.
PROGRAM-ID. DELSTU.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE STUCPY
END-EXEC.
77 WS-SQLCODE PIC S9(9) SIGN LEADING SEPARATE CHARACTER.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
COPY DFHAID.
COPY DFHBMSCA.
COPY STUSET1.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO STUMAP1I.
MOVE LOW-VALUES TO STUMAP1O.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE MAP('STUMAP1')
MAPSET('STUSET1')
INTO(STUMAP1I)
END-EXEC.
MOVE SNOI TO HS-STU-NO.
EXEC SQL
DELETE FROM IND_STU
WHERE STU_NO = :HS-STU-NO
END-EXEC.
IF SQLCODE = 0
MOVE 'DELETE SUCCESSFUL' TO MSGO
PERFORM SEND-PARA
ELSE
MOVE SQLCODE TO WS-SQLCODE
MOVE WS-SQLCODE TO MSGO
PERFORM SEND-PARA
END-IF.
SEND-PARA.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
FROM(STUMAP1O)
END-EXEC.
EXEC CICS RETURN
END-EXEC.
UPDATE DB2 program
IDENTIFICATION DIVISION.
PROGRAM-ID. UPDSTU.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE STUCPY
END-EXEC.
77 WS-SQLCODE PIC S9(9) SIGN LEADING SEPARATE CHARACTER.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
COPY DFHAID.
COPY DFHBMSCA.
COPY STUSET1.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO STUMAP1I.
MOVE LOW-VALUES TO STUMAP1O.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE MAP('STUMAP1')
MAPSET('STUSET1')
INTO(STUMAP1I)
END-EXEC.
MOVE SNOI TO HS-STU-NO.
EXEC SQL
SELECT STU_NO, STU_NAME, STU_ADDR
INTO :HS-STU-NO,
:HS-STU-NAME,
:HS-STU-ADDR
FROM IND_STU
WHERE STU_NO = :HS-STU-NO
END-EXEC.
IF SQLCODE = 0
MOVE 'SELECT SUCCESSFUL' TO MSGO
PERFORM UPDATE-PARA
ELSE
MOVE SQLCODE TO WS-SQLCODE
MOVE WS-SQLCODE TO MSGO
PERFORM SEND-PARA
END-IF.
UPDATE-PARA.
MOVE HS-STU-NO TO SNOO.
MOVE HS-STU-NAME TO SNAMEO.
MOVE HS-STU-ADDR TO SADDRO.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
FROM(STUMAP1O)
END-EXEC.
EXEC CICS RECEIVE MAP('STUMAP1')
MAPSET('STUSET1')
INTO(STUMAP1I)
END-EXEC.
MOVE SNOI TO HS-STU-NO.
MOVE SNAMEI TO HS-STU-NAME.
MOVE SADDRI TO HS-STU-ADDR.
EXEC SQL
UPDATE IND_STU
SET STU_ADDR = :HS-STU-ADDR
WHERE STU_NO = :HS-STU-NO
END-EXEC.
IF SQLCODE = 0
MOVE LOW-VALUES TO STUMAP1O
MOVE 'UPDATE SUCCESSFUL' TO MSGO
ELSE
MOVE SQLCODE TO WS-SQLCODE
MOVE WS-SQLCODE TO MSGO
PERFORM END-PARA
END-IF.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
FROM(STUMAP1O)
END-EXEC.
PERFORM END-PARA.
SEND-PARA.
EXEC CICS SEND MAP('STUMAP1')
MAPSET('STUSET1')
FROM(STUMAP1O)
END-EXEC.
PERFORM END-PARA.
END-PARA.
EXEC CICS RETURN
END-EXEC.
LINK program
IDENTIFICATION DIVISION.
PROGRAM-ID. MENUKSST.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-LEN PIC S9(4) COMP VALUE ZERO.
COPY DFHAID.
COPY DFHBMSCA.
COPY MSTSET1.
77 WS-OPTION PIC 9 VALUE ZERO.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE LOW-VALUES TO MSTMAP1I.
MOVE LOW-VALUES TO MSTMAP1O.
EXEC CICS SEND MAP('MSTMAP1')
MAPSET('MSTSET1')
ERASE
END-EXEC.
EXEC CICS RECEIVE MAP('MSTMAP1')
MAPSET('MSTSET1')
INTO(MSTMAP1I)
END-EXEC.
MOVE OPTI TO WS-OPTION.
EVALUATE WS-OPTION
WHEN 1 PERFORM CAL-SEL-PARA
WHEN 2 PERFORM CAL-UPD-PARA
WHEN 3 PERFORM CAL-DEL-PARA
WHEN 4 PERFORM CAL-INS-PARA
WHEN OTHER PERFORM CAL-OTH-PARA
END-EVALUATE.
EXEC CICS RETURN END-EXEC.
CAL-SEL-PARA.
EXEC CICS LINK
PROGRAM('VINKSREA')
END-EXEC.
CAL-UPD-PARA.
EXEC CICS XCTL
PROGRAM('VINKSUPD')
END-EXEC.
CAL-DEL-PARA.
EXEC CICS XCTL
PROGRAM('VINKSDEL')
END-EXEC.
CAL-INS-PARA.
EXEC CICS XCTL
PROGRAM('VINKSWRI')
END-EXEC.
CAL-OTH-PARA.
MOVE 'ENTER 1 OR 2 OR 3 OR 4 ' TO MSGO.
GO TO MAIN-PARA.
TSQ program
IDENTIFICATION DIVISION.
PROGRAM-ID. TSQWRI.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 EMP-REC.
05 EMP-NO PIC 9(4).
05 EMP-NAME PIC X(10).
05 EMP-ADDR PIC X(10).
01 TSQ-ID.
05 TSQ-QID-DIV PIC X VALUE 'A'.
05 TSQ-QID-TERM PIC X(4).
05 TSQ-QID-APPL PIC X VALUE 'D'.
05 TSQ-QID-NUM PIC 99 VALUE 11.
COPY DFHAID.
COPY DFHBMSCA.
COPY EMPSET1.
77 TSQ-LEN PIC S9(4) COMP.
77 TSQ-ITEM PIC S9(4) COMP.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO EMPMAP1I.
MOVE LOW-VALUES TO EMPMAP1O.
EXEC CICS SEND
MAP('EMPMAP1')
MAPSET('EMPSET1')
END-EXEC.
EXEC CICS RECEIVE
MAP('EMPMAP1')
MAPSET('EMPSET1')
INTO(EMPMAP1I)
END-EXEC.
MOVE ENOI TO EMP-NO.
MOVE ENAMEI TO EMP-NAME.
MOVE EADDRI TO EMP-ADDR.
MOVE 24 TO TSQ-LEN.
MOVE 1 TO TSQ-ITEM.
MOVE EIBTRMID TO TSQ-QID-TERM.
EXEC CICS WRITEQ TS
QUEUE(TSQ-ID)
FROM(EMP-REC)
LENGTH(TSQ-LEN)
ITEM(TSQ-ITEM)
MAIN
END-EXEC.
EXEC CICS RETURN
END-EXEC.
STOP RUN.
9 comments
This is wonderful site for currently working people or searching people on mainframe technology,
I have never seen this type of good website really.
Karunaar-karunakar702@gmail.com
good site but some information missing like cics mas
good site but some information missing like cics maps
Very clean,simple,understandable examples .Very helpful especially for newbies
Can you add the maps that your referring to. Without it its impossible to piece together everything.
I certainly agree to some points that you have discussed on this post. I appreciate that you have shared some reliable tips on this review.
What you are spoken communication is totally true. i do know that everyone should say a similar factor, however I simply assume that you simply place it in an exceedingly method that everybody will perceive. i am positive you may reach such a lot of folks with what you've to mention.
Just great!!! Commendable...
!!!
The send map/receive map example is conversational (as opposed to pseudo-conversational), which is highly discouraged in CICS.
But I understand why it was done this way -- to provide a basic example.
Good job.
Post a Comment