You are on page 1of 5

IDENTIFICATION DIVISION.

000002 PROGRAM-ID. SAMPLE.


000003 DATA DIVISION.
000004 WORKING-STORAGE SECTION.
000005 01 NREC.
000006 05 NU PIC 99.
000007 05 NA PIC X(18).
000008 COPY KUMSET.
000009 COPY DFHBMSCA.
000010 01 NNN.
000011 05 N1 PIC 99.
000012 05 N2 PIC X(18).
000013 01 A PIC 99 COMP VALUE 1.
000014 01 WSS PIC X(5).
000015 01 LSS PIC 9(2) COMP.
000016 01 ITM PIC S9(4) COMP.
000017 01 AAA.
000018 05 D PIC 99.
000019 05 B PIC 99.
000020 05 C PIC 99.
000021 PROCEDURE DIVISION.
000022 MAIN-CODE.
000023*EACH KEY HAS ITS OWN FUNCTION
000024 EXEC CICS HANDLE AID
000025 PF1(0001)
000026 PF2(0006)
000027 PF3(0007)
000028 PF4(0008)
000029 PF5(00001)
000030 PF6(0606)
000031 PF7(0707)
000032 PF8(0808)
000033 END-EXEC.
000034 EXEC CICS HANDLE CONDITION
000035 ENDFILE(0505)
000036 NOTFND(0505)
000037 QZERO(0505)
000038 ERROR(0404)
000039 END-EXEC.
000040 MOVE 'WELCOME' TO WSS.
000041 EXEC CICS SEND CONTROL ALARM
000042 END-EXEC.
000043 EXEC CICS SEND TEXT
000044 FROM(WSS)
000045 ERASE
000046 END-EXEC.
000047 EXEC CICS SEND
000048 MAP('KUMMAP')
000049 MAPSET('KUMSET')
000050 FROM(KUMMAPO)
000051 ALARM
000052 ERASE
000053 END-EXEC.
000054 EXEC CICS RECEIVE
000055 MAP('KUMMAP')
000056 MAPSET('KUMSET')
000057 INTO(KUMMAPI)
000058 END-EXEC.
000059 MOVE NUMI TO NU.
000060 MOVE NAMEI TO NA.
000061 EXEC CICS WRITE
000062 FILE('MACF')
000063 FROM(NREC)
000064 RIDFLD(NU)
000065 END-EXEC.
000066 EXEC CICS READ
000067 FILE('MACF')
000068 INTO(NREC)
000069 RIDFLD(NU)
000070 END-EXEC.
000071 MOVE 'OUTPUT' TO ABCO.
000072 MOVE NA TO NAMEO.
000073 MOVE NU TO NUMO.
000074 EXEC CICS SEND
000075 MAP('KUMMAP')
000076 MAPSET('KUMSET')
000077 FROM(KUMMAPO)
000078 CURSOR(300)
000079 ERASE
000080 END-EXEC.
000081 EXEC CICS RETURN
000082 END-EXEC.
000083 0404.
000084 MOVE 'ERROR' TO WSS.
000085 MOVE 5 TO LSS.
000086 EXEC CICS LINK
000087 PROGRAM('CA3')
000088 COMMAREA(WSS)
000089 LENGTH(LSS)
000090 END-EXEC.
000091 MOVE 'RETURN' TO ABCO.
000092 MOVE 'SUCCESS' TO NAMEO.
000093 MOVE 55 TO NUMO.
000094 MOVE -1 TO NUML.
000095 EXEC CICS SEND
000096 MAP('KUMMAP')
000097 MAPSET('KUMSET')
000098 FROM(KUMMAPO)
000099 CURSOR
000100 ERASE
000101 END-EXEC.
000102 EXEC CICS RETURN
000103 END-EXEC.
000104 0001.
000105 MOVE 'PF1' TO ABC1O.
000106 0003.
000107 MOVE A TO NUM1O.
000108 MOVE 'ACCUM' TO NAME1O.
000109 EXEC CICS SEND
000110 MAP('KUMMAP1')
000111 MAPSET('KUMSET')
000112 FROM(KUMMAP1O)
000113 ACCUM
000114 PAGING
000115 END-EXEC.
000116 MOVE 'ERROR' TO ABC2O.
000117 EXEC CICS SEND
000118 MAP('KUMMAP2')
000119 MAPSET('KUMSET')
000120 FROM(KUMMAP2O)
000121 ACCUM
000122 PAGING
000123 END-EXEC.
000124 COMPUTE A = A + 1.
000125 IF A < 5 GO TO 0003.
000126 EXEC CICS SEND PAGE
000127 END-EXEC.
000128 EXEC CICS RETURN
000129 END-EXEC.
000130 0006.
000131 MOVE 25 TO NU.
000132 MOVE 'CCCCC' TO NA.
000133 EXEC CICS WRITEQ
000134 QUEUE('SUMA')
000135 FROM(NREC)
000136 ITEM(ITM)
000137 MAIN
000138 END-EXEC.
000139 MOVE 1 TO ITM.
000140 EXEC CICS READQ
000141 QUEUE('SUMA')
000142 INTO(NREC)
000143 ITEM(ITM)
000144 END-EXEC.
000145 MOVE 'QUEUE' TO ABCO.
000146 MOVE NA TO NAMEO.
000147 MOVE NU TO NUMO.
000148 EXEC CICS SEND
000149 MAP('KUMMAP')
000150 MAPSET('KUMSET')
000151 FROM(KUMMAPO)
000152 ERASE
000153 END-EXEC.
000154 EXEC CICS RETURN END-EXEC.
000155 0007.
000156 MOVE 'ACCUM' TO NAME1O.
000157 EXEC CICS SEND
000158 MAP('KUMMAP1')
000159 MAPSET('KUMSET')
000160 FROM(KUMMAP1O)
000161 ACCUM
000162 END-EXEC.
000163 MOVE 'ERROR' TO ABC2O.
000164 EXEC CICS SEND
000165 MAP('KUMMAP2')
000166 MAPSET('KUMSET')
000167 FROM(KUMMAP2O)
000168 ACCUM
000169 END-EXEC.
000170 EXEC CICS SEND PAGE END-EXEC.
000171 EXEC CICS RETURN END-EXEC.
000172 0008.
000173 MOVE 0 TO NU.
000174 EXEC CICS STARTBR
000175 FILE('MACF')
000176 RIDFLD(NU)
000177 END-EXEC.
000178 00001.
000179 EXEC CICS READNEXT
000180 FILE('MACF')
000181 INTO(NREC)
000182 RIDFLD(NU)
000183 END-EXEC.
000184 MOVE 'OUTPUT' TO ABCO.
000185 MOVE NA TO NAMEO.
000186 MOVE NU TO NUMO.
000187 EXEC CICS SEND
000188 MAP('KUMMAP')
000189 MAPSET('KUMSET')
000190 FROM(KUMMAPO)
000191 END-EXEC.
000192 GO TO 00001.
000193 0505.
000194 MOVE 'ENDED' TO WSS.
000195 EXEC CICS SEND TEXT
000196 FROM(WSS)
000197 ERASE
000198 END-EXEC.
000199 EXEC CICS RETURN END-EXEC.
000200 0606.
000201 EXEC CICS ASKTIME END-EXEC.
000202 MOVE 223344 TO AAA.
000203 EXEC CICS SEND FROM(AAA) ERASE END-EXEC.
000204 EXEC CICS RECEIVE
000205 INTO(AAA)
000206 END-EXEC.
000207 EXEC CICS SEND
000208 FROM(AAA)
000209 ERASE
000210 END-EXEC.
000211 EXEC CICS RETURN END-EXEC.
000212 0707.
000213 MOVE 'NEGA' TO WSS.
000214 EXEC CICS SEND TEXT
000215 FROM(WSS)
000216 ERASE
000217 END-EXEC.
000218 EXEC CICS SEND
000219 MAP('KUMMAP')
000220 MAPSET('KUMSET')
000221 FROM(KUMMAPO)
000222 ERASE
000223 END-EXEC.
000224 EXEC CICS RECEIVE
000225 MAP('KUMMAP')
000226 MAPSET('KUMSET')
000227 INTO(KUMMAPI)
000228 END-EXEC.
000229 MOVE NUMI TO N1.
000230 MOVE NAMEI TO N2.
000231 MOVE 'NEGGG' TO ABCO.
000232 MOVE N1 TO NUMO.
000233 MOVE N2 TO NAMEO.
000234 EXEC CICS SEND
000235 MAP('KUMMAP')
000236 MAPSET('KUMSET')
000237 FROM(KUMMAPO)
000238 ERASE
000239 END-EXEC.
000240 EXEC CICS RETURN END-EXEC.
000241 0808.
000242 MOVE DFHBMEOF TO NAMEA.
000243 EXEC CICS SEND
000244 MAP('KUMMAP')
000245 MAPSET('KUMSET')
000246 CURSOR
000247 ERASE
000248 END-EXEC.
000249 EXEC CICS RETURN END-EXEC.

http://ibmmainframes.com/viewtopic.php?t=41536&highlight=paging