Spi Trade Cics Course Ware (Adv Cics)

Download Spi Trade Cics Course Ware (Adv Cics)

Post on 20-Nov-2014

111 views

Category:

Documents

2 download

Embed Size (px)

TRANSCRIPT

<p>Advanced CICS</p> <p>Version 2</p> <p>SPI Confidential</p> <p>1</p> <p>ContentsA. B. C. D. Coding CICS Program Sample Program Temporary storage control Some more CICS commands &amp; programming techniques E. Processing files sequentially F. More CICS control features G. Legacy coding conventions</p> <p>Version 2</p> <p>SPI Confidential</p> <p>2</p> <p>A. Coding CICS Program</p> <p>Version 2</p> <p>SPI Confidential</p> <p>3</p> <p>A01</p> <p>How to code a CICS program</p> <p> How to control the execution of the programs within a task How to work with mapsets How to work with files Other coding essentials</p> <p>Version 2</p> <p>SPI Confidential</p> <p>4</p> <p>A02</p> <p>How to control the execution of the programs within a task</p> <p> The operation of program control commands RETURN command XCTL command LINK command COBOL CALL statement ABEND commandVersion 2 SPI Confidential 5</p> <p>A02a</p> <p>The operation of program control commands</p> <p>Version 2</p> <p>SPI Confidential</p> <p>6</p> <p>A02a1</p> <p>Flow of control between programs and subprograms</p> <p>Version 2</p> <p>SPI Confidential</p> <p>7</p> <p>A02b</p> <p>RETURN command</p> <p>Version 2</p> <p>SPI Confidential</p> <p>8</p> <p>A02c</p> <p>XCTL command</p> <p>Version 2</p> <p>SPI Confidential</p> <p>9</p> <p>A02d</p> <p>LINK command</p> <p>Version 2</p> <p>SPI Confidential</p> <p>10</p> <p>A02e</p> <p>COBOL CALL statement</p> <p>Syntax: CALL (subprogram-name | data-area) [USING identifier-1 ] Example: MOVE COMMUNICATION-AREA TO DFHCOMMAREA. CALL GETINV USING DFHEIBLK, DFHCOMMAREA, INV-INVOICE-NUMBER.Version 2 SPI Confidential 11</p> <p>A02f</p> <p>ABEND command</p> <p>Syntax: EXEC CICS ABEND [ABCODE (abend-code)] [NODUMP] END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>12</p> <p>A03</p> <p>How to work with mapsets</p> <p>Syntax of SEND MAP EXEC CICS SEND MAP (map-name) [MAPSET(mapset-name)] [FROM (data-name)] [MAPONLY | DATAONLY] [ERASE | ERASEAUP] [ALARM] [CURSOR [(data-value)]] END-EXEC Syntax of RECEIVE MAP EXEC CICS RECEIVE MAP(map-name) [MAPSET(mapset-name)] [INTO (data-name)] END-EXECVersion 2 SPI Confidential 13</p> <p>A04</p> <p>How to work with files</p> <p> READ command WRITE command REWRITE command DELETE command UNLOCK command</p> <p>Version 2</p> <p>SPI Confidential</p> <p>14</p> <p>A04a</p> <p>READ commandFILE (filename) INTO (data-name) RIDFLD (data-name) [RRN | RBA] [UPDATE]</p> <p>Syntax: EXEC CICS READ</p> <p>END-EXEC</p> <p>Example: EXEC CICS READ</p> <p>FILE (CUSTMAS) INTO (CUSTOMER-MASTER-RECORD) RIDFLD (CM-CUSTOMER-NUMBER) UPDATE RESP(RESPONSE-CODE)</p> <p>END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>15</p> <p>A04b</p> <p>WRITE command</p> <p>Syntax: EXEC CICS WRITE FILE (filename) FROM (data-name) RIDFLD (data-name) [RRN | RBA] END-EXEC</p> <p>Example: EXEC CICS WRITE FILE (CUSTMAS) INTO (CUSTOMER-MASTER-RECORD) RIDFLD (CM-CUSTOMER-NUMBER) RESP(RESPONSE-CODE) END-EXECVersion 2 SPI Confidential 16</p> <p>A04c</p> <p>REWRITE command</p> <p>Syntax: EXEC CICS REWRITE FILE (filename) FROM (data-name) END-EXEC</p> <p>Example: EXEC CICS REWRITE FILE (CUSTMAS) FROM (CUSTOMER-MASTER-RECORD) RESP(RESPONSE-CODE) END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>17</p> <p>A04d</p> <p>DELETE commandFILE (filename) RIDFLD (data-name) [RRN | RBA]</p> <p>Syntax: EXEC CICS DELETE</p> <p>END-EXEC</p> <p>Example (record previously read for update): EXEC CICS DELETE FILE (CUSTMAS) RESP(RESPONSE-CODE) END-EXEC Example (record not previously read for update): EXEC CICS DELETE FILE (CUSTMAS) RIDFLD (CUSTOMER-MASTER-RECORD) RESP(RESPONSE-CODE) END-EXEC Version 2 SPI Confidential 18</p> <p>A04e</p> <p>UNLOCK command</p> <p>Syntax: EXEC CICS UNLOCK FILE (filename) END-EXEC</p> <p>Example: EXEC CICS UNLOCK FILE (CUSTMAS) END-EXECVersion 2 SPI Confidential 19</p> <p>A04f</p> <p>Potential problems when updating file</p> <p> One program changes or deletes a record while another is trying to update it Deadlock: Two tasks are each waiting for a resource that the other is holding.</p> <p>Version 2</p> <p>SPI Confidential</p> <p>20</p> <p>A05</p> <p>Other coding essentials</p> <p> Common exceptional conditions Using response code Defining communication area Managing event context of a program</p> <p>Version 2</p> <p>SPI Confidential</p> <p>21</p> <p>A05a</p> <p>Common exceptional conditions</p> <p>Version 2</p> <p>SPI Confidential</p> <p>22</p> <p>A05b</p> <p>Using response code</p> <p>Syntax: [RESP (data-name)]Example: EXEC CICS READ FILE (CUSTMAS) INTO (CUSTOMER-MASTER-RECORD) RIDFLD (CM-CUSTOMER-NUMBER) RESP(RESPONSE-CODE) END-EXEC EVALUATE RESPONSE-CODE WHEN DFHRESP(NORMAL) MOVE input-fields TO display-area WHEN DFHRESP(NOTFND) MOVE Customer does not exist TO message-display-area WHEN OTHER EXEC CICS ABEND END-EXEC END-EVALUATE Version 2 SPI Confidential 23</p> <p>A05c</p> <p>Defining communication areaPIC X. VALUE VALUE VALUE VALUE 1. 2. 3. 4.</p> <p>01 COMMUNICATION-AREA. 05 CA-CONTEXT-FLAG 88 PROCESS-KEY-MAP 88 PROCESS-ADD-CUSTOMER 88 PROCESS-CHANGE-CUSTOMER 88 PROCESS-DEL-CUSTOMER 05 CA-CUSTOMER-RECORD. 10 CA-CUSTOMER-NUMBER 10 FILLER</p> <p>PIC X(6). PIC X(112).</p> <p>Version 2</p> <p>SPI Confidential</p> <p>24</p> <p>A05d</p> <p>Sample Program (Requirement)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>25</p> <p>Event/response chartA05e</p> <p>Version 2</p> <p>SPI Confidential</p> <p>26</p> <p>A05f</p> <p>Managing event context of a program</p> <p>Version 2</p> <p>SPI Confidential</p> <p>27</p> <p>B. Sample CICS Program</p> <p>Version 2</p> <p>SPI Confidential</p> <p>28</p> <p>B01</p> <p>Structure chart</p> <p>Version 2</p> <p>SPI Confidential</p> <p>29</p> <p>B02a</p> <p>Program code</p> <p>Version 2</p> <p>SPI Confidential</p> <p>30</p> <p>B02b</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>31</p> <p>B02c</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>32</p> <p>B02d</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>33</p> <p>B02e</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>34</p> <p>B02f</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>35</p> <p>B02g</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>36</p> <p>B02h</p> <p>Program code (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>37</p> <p>C. Temporary storage control</p> <p>Version 2</p> <p>SPI Confidential</p> <p>38</p> <p>C01</p> <p>Temporary storage queue concepts</p> <p>Version 2</p> <p>SPI Confidential</p> <p>39</p> <p>C02</p> <p>WRITEQ TS commandExample:Add record to TSQEXEC CICS WRITEQ TS QUEUE (TS-QUEUE-NAME) FROM (TS-QUEUERECORD) END-EXEC</p> <p>Syntax:EXEC CICS WRITEQ TS {QUEUE | QNAME} (queue-name) FROM (data-name) [ITEM (data-name) REWRITE] [NUMITEMS(data-name)] [MAIN | AUXILIARY] END-EXEC</p> <p>Update an existing record in TSQEXEC CICS WRITEQ TS QUEUE (TS-QUEUE-NAME) FROM (TS-QUEUERECORD) ITEM (TS-ITEMNUMBER) REWRITE RESP (RESPONSE-CODE END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>40</p> <p>C03</p> <p>READQ TS commandExample:Read a record from TSQ randomlyEXEC CICS READQ TS QUEUE (TS-QUEUE-NAME) INTO (TS-QUEUERECORD) ITEM (TS-ITEM-NUMBER) RESP (RESPONSE-CODE) END-EXEC</p> <p>Syntax:EXEC CICS READQ TS</p> <p>{ QUEUE | QNAME} (queue-name) INTO (data-name) [ ITEM (data-name) | literal | NEXT ] [ NUMITEMS (data-name) ]</p> <p>END-EXEC</p> <p>Read the next record from TSQEXEC CICS READQ TS QUEUE (TS-QUEUE-NAME) INTO (TS-QUEUERECORD) NEXT END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>41</p> <p>C04</p> <p>DELETEQ TS commandExample:Delete a TSQEXEC CICS DELETEQ TS QUEUE (TS-QUEUENAME) RESP (RESPONSECODE END-EXEC</p> <p>Syntax:EXEC CICS DELETEQ TS { QUEUE | QNAME} (queue-name) END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>42</p> <p>C05a</p> <p>Sample program using TSQ</p> <p>Version 2</p> <p>SPI Confidential</p> <p>43</p> <p>C05b</p> <p>Sample program using TSQ (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>44</p> <p>C05c</p> <p>Sample program using TSQ (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>45</p> <p>Temporary storage command -</p> <p>CEBRThe CEBR command lets one browse the contents of a temporary storage queue which may be required while testing a program. The syntax is as follows: CEBR (queue-name) This brings up the details of the queue specified in the queue-name option, as shown below.</p> <p>Version 2</p> <p>SPI Confidential</p> <p>46</p> <p>D. Some more CICS commands &amp; programming techniques</p> <p>Version 2</p> <p>SPI Confidential</p> <p>47</p> <p>D01</p> <p>Some more CICS commands &amp; programming techniquesPositioning the cursor Modifying field attributes Optimizing data transmission Identifying data entry fields Editing input data Editing numeric data Sample programs that edit numeric data Using SEND TEXT command</p> <p> Terminal handling techniques </p> <p> Handling unrecoverable errors Invoking a general error handling program COBOL code for general error handling</p> <p> Accessing data using Linkage Section Using fields in the EIB Accessing CICS areas</p> <p> Formatting date &amp; time Using ASKTIME command Using FORMATTIME commandVersion 2 SPI Confidential 48</p> <p>D02a</p> <p>Terminal handling techniques: Positioning the cursorDFHMDF POS=(2,26), LENGTH=6, ATTRB=(NORM, UNPROT, IC), X X X</p> <p>Using IC option in DFHMDFCUSTNO</p> <p>...</p> <p>Using direct cursor positioningEXEC CICS SEND MAP (MNTMAP1) MAPSET(MNTSET1) FROM(MNTMAP1O) CURSOR(346) END-EXEC</p> <p>Using symbolic cursor positioningMOVE -1 TO CUSTNOIL. EXEC CICS SEND MAP (MNTMAP1) MAPSET(MNTSET1) FROM(MNTMAP1O) CURSOR END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>49</p> <p>D02b1</p> <p>Terminal handling techniques: Modifying field attributes</p> <p>Version 2</p> <p>SPI Confidential</p> <p>50</p> <p>D02b2</p> <p>Terminal handling techniques: Modifying field attributes</p> <p>Version 2</p> <p>SPI Confidential</p> <p>51</p> <p>D02c1</p> <p>Terminal handling techniques: Optimizing data transmission</p> <p>Minimize data sent from program to terminal Move Low-Value to symbolic map fields present on screen and should remain unchanged Use DATAONLY with SEND MAP when sending data using a map already onscreen</p> <p>Version 2</p> <p>SPI Confidential</p> <p>52</p> <p>D02c2</p> <p>Terminal handling techniques: Optimizing data transmission (contd.)Maintain copy of screen-fields in CA Specifying FRSET on SEND MAP to turn off the MDT of all unprotected fields After issuing RECEIVE MAP, merge new entries with fields saved in CA from previous transmission</p> <p>Minimize data sent to program when user presses attention key</p> <p>Version 2</p> <p>SPI Confidential</p> <p>53</p> <p>D02d1</p> <p>Terminal handling techniques: Screen format recommendations</p> <p>Version 2</p> <p>SPI Confidential</p> <p>54</p> <p>D02d2</p> <p>Terminal handling techniques: Screen format recommendations</p> <p>Version 2</p> <p>SPI Confidential</p> <p>55</p> <p>D02d3</p> <p>Terminal handling techniques: Identifying data entry fields</p> <p>Version 2</p> <p>SPI Confidential</p> <p>56</p> <p>D02e</p> <p>Terminal handling techniques: Editing input data</p> <p>Version 2</p> <p>SPI Confidential</p> <p>57</p> <p>D02f</p> <p>Terminal handling techniques: Editing numeric data</p> <p>Version 2</p> <p>SPI Confidential</p> <p>58</p> <p>D02g1</p> <p>Terminal handling techniques:</p> <p>Sample program that edits numeric data (INTEDIT)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>59</p> <p>D02g2a</p> <p>Terminal handling techniques:Sample program that edits numeric data (NUMEDIT)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>60</p> <p>D02g2b</p> <p>Terminal handling techniques:Sample program that edits numeric data (NUMEDIT)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>61</p> <p>D02h</p> <p>Terminal handling techniques: Using SEND TEXT commandFROM (data-name) [ERASE] [FREEKB]</p> <p>Syntax:EXEC CICS SEND TEXT</p> <p>END-EXEC</p> <p>Example:WORKING-STORAGE SECTION. 01 TERMINATION-MESSAGE PIC X(14) VALUE Session ended. . . PROCEDURE DIVISION. . .EXEC CICS SEND TEXT ERASE FREEKB END-EXEC FROM (TERMINATION-MESSAGE)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>62</p> <p>D03a</p> <p>Handling unrecoverable errors:Invoking a general error handling program</p> <p>Version 2</p> <p>SPI Confidential</p> <p>63</p> <p>D03b</p> <p>Handling unrecoverable errors:COBOL code for general error handling</p> <p>Version 2</p> <p>SPI Confidential</p> <p>64</p> <p>D04a</p> <p>Accessing data using Linkage Section Using fields in the EIB</p> <p>Version 2</p> <p>SPI Confidential</p> <p>65</p> <p>D04b</p> <p>Accessing data using Linkage Section Accessing CICS areas Sample:LINKAGE SECTION. * 01 DFHCOMMAREA PIC X. * 01 COMMON-WORK-AREA. 05 CWA-CURRENT-DATE PIC X(8). 05 CWA-COMPANY-NAME PIC X(30). * PROCEDURE DIVISION. * . . EXEC CICS ADDRESS CWA (ADDRESS OF COMMON-WORKAREA) END-EXEC. MOVE CWA-COMPANY-NAME TO COMPO.</p> <p>Syntax:EXEC CICS ADDRESS [CWA (pointer)] [TWA (pointer)] [TCTUA (pointer)] END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>66</p> <p>D05a</p> <p>Formatting date &amp; timeUsing ASKTIME command Sample:WORKING-STORAGE SECTION. . . 01 DATE-AND-TIME-FIELDS. 05 ABSOLUTE-TIME PIC S9(15) COMP-3. . . PROCEDURE DIVISION. . . EXEC CICS</p> <p>SYNTAX:EXEC CICS ASKTIME [ABSTIME (data-name) END-EXEC</p> <p>ASKTIME ABSTIME (ABSOLUTETIME))END-EXEC. . .</p> <p>Version 2</p> <p>SPI Confidential</p> <p>67</p> <p>Formatting date &amp; timeD05b1</p> <p>Using FORMATTIME command</p> <p>Version 2</p> <p>SPI Confidential</p> <p>68</p> <p>Formatting date &amp; timeD05b2</p> <p>Using FORMATTIME command (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>69</p> <p>D05b3</p> <p>Formatting date &amp; timeUsing FORMATTIME command (contd.)</p> <p>SamplesFormat default date &amp; timeEXEC CICS FORMATTIME ABSTIME (ABSOLUTE-TIME) DATE(WS-DATE) DATESEP TIME(WS-TIME) TIMESEP END-EXEC</p> <p>Format dd-mm-yyyy dateEXEC CICS FORMATTIME ABSTIME (ABSOLUTE-TIME) DDMMYYYY(WS-FULL-DATE) DATESEP(-) END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>70</p> <p>E. Processing files sequentially</p> <p>Version 2</p> <p>SPI Confidential</p> <p>71</p> <p>E01</p> <p>Processing files sequentially</p> <p> STARTBR READNEXT &amp; READPREV ENDBR RESETBR</p> <p>Version 2</p> <p>SPI Confidential</p> <p>72</p> <p>E02a</p> <p>Processing files sequentiallySTARTBR</p> <p>Syntax of STARTBR EXEC CICS STARTBR FILE(filename) RIDFLD(data-name) [RRN | RBA] [GTEQ | EQUAL] [GENERIC] [KEYLENGTH (data-name) | literal] END-EXEC Sample of STARTBR EXEC CICS STARTBR FILE(CUSTMAS) RIDFLD(CM-CUSTOMER-NUMBER) RESP(RESPONSE-CODE) END-EXECVersion 2 SPI Confidential 73</p> <p>E02b</p> <p>Processing files sequentiallyControlling STARTBR position</p> <p>Version 2</p> <p>SPI Confidential</p> <p>74</p> <p>E03a</p> <p>Processing files sequentiallyREADNEXT &amp; READPREV</p> <p>Syntax of READNEXT &amp; READPREVEXEC CICS [READNEXT | READPREV]</p> <p>FILE(filename) INTO(data-name) RIDFLD(data-name) [RRN | RBA] [KEYLENGTH (data-name) | literal]</p> <p>END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>75</p> <p>E03b</p> <p>Processing files sequentiallyA typical READNEXT procedure</p> <p>Version 2</p> <p>SPI Confidential</p> <p>76</p> <p>E04</p> <p>Processing files sequentiallyENDBR</p> <p>Syntax of ENDBREXEC CICS ENDBR FILE(filename) END-EXEC</p> <p>SampleEXEC CICS ENDBR FILE(INVOICE) END-EXEC</p> <p>Version 2</p> <p>SPI Confidential</p> <p>77</p> <p>E05</p> <p>Processing files sequentiallyRESETBR</p> <p>Syntax of RESETBREXEC CICS RESETBR FILE(filename) RIDFLD(data-name) [RRN | RBA] [GTEQ | EQUAL] [GENERIC] [KEYLENGTH (data-name | literal)] END-EXEC</p> <p>SampleEXEC CICS RESETBR FILE(CUSTMAS) RIDFLD(CM-CUSTOMER-NUMBER) EQUAL RESP(RESPONSE-CODE) END-EXEC Version 2 SPI Confidential 78</p> <p>E06</p> <p>Processing files sequentiallyExceptional conditions</p> <p>Version 2</p> <p>SPI Confidential</p> <p>79</p> <p>F. More CICS control features</p> <p>Version 2</p> <p>SPI Confidential</p> <p>80</p> <p>F01</p> <p>More CICS control features</p> <p> Interval control Automatic time-ordered transaction START RETRIEVE CANCEL DELAY</p> <p> Task control SUSPEND ENQ &amp; DEQ</p> <p> Storage control GETMAIN FREEMAINVersion 2 SPI Confidential 81</p> <p>F02a</p> <p>Interval controlAutomatic time-ordered transaction initiation</p> <p>Version 2</p> <p>SPI Confidential</p> <p>82</p> <p>F02b</p> <p>Interval controlAutomatic time-ordered transaction initiation (contd.)</p> <p>Version 2</p> <p>SPI Confidential</p> <p>83</p> <p>F03a</p> <p>Interval controlSTART</p> <p>Version 2</p> <p>SPI Confidential</p> <p>84</p> <p>F03b</p> <p>Interval controlSTART examples</p> <p>Version 2</p> <p>SPI Confidential</p> <p>85</p> <p>F04</p> <p>Interval c...</p>

Recommended

View more >