{"id":424,"date":"2012-01-17T19:18:29","date_gmt":"2012-01-18T01:18:29","guid":{"rendered":"http:\/\/tommysprinkle.com\/txxos\/?p=424"},"modified":"2021-04-17T18:19:41","modified_gmt":"2021-04-17T23:19:41","slug":"s035wto-write-to-operator-console","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/txxos\/?p=424","title":{"rendered":"S035WTO &#8211; Write To Operator Console"},"content":{"rendered":"<p>We will create the WTO SVC to queue messages to the console. \u00a0When the SVC is called Register 1 contains the address of the message in the bottom three bytes (24 bit address) and the high order byte contains the length of the message. \u00a0If the message length is greater than 79 bytes it will be truncated. \u00a0If it is less than 79 bytes it will be padded with blanks.<\/p>\n<pre>000000                               14 S035WTO  CSECT , \r\n000000 18CF                          15          LR    R12,R15            SET UP \r\n                            00000    16          USING S035WTO,R12              BASE REGISTER \r\n                                     17 *\r\n000002 18B1                          18          LR    R11,R1             COPY PARM REGISTER\r\n000004 58A0 0010      00010          19          L     R10,16             CVT\r\n000008 58A0 A014      00014          20          L     R10,CVTCCB-@CVT(,R10)   CONSOLE COMMUNICATION BLOCK \r\n                            00000    21          USING @CCB,R10 \r\n                                     22 * \r\n00000C 12AA                          23          LTR   R10,R10            DO WE HAVE A CONSOLE \r\n00000E 4780 C09A      0009A          24          BZ    WTO900              NO - GO ABEND \r\n                                     25 * \r\n000012                               26 WTO010   DS    0H \r\n000012 5890 A008      00008          27          L     R9,CCBFMQ          GET FREE BUFFER  \r\n000016 1299                          28          LTR   R9,R9               AND FREE\r\n000018 4780 C0A2      000A2          29          BZ    WTO910               NO - CAN'T DO \r\n                                     30 * \r\n00001C 5820 9000      00000          31          L     R2,0(,R9)          FWD CHAIN PTR \r\n000020 BA92 A008      00008          32          CS    R9,R2,CCBFMQ       REMOVE FROM CHAIN\r\n000024 4770 C012      00012          33          BNZ   WTO010 \r\n                                     34 * \r\n                            00000    35          USING @CMB,R9<\/pre>\n<p>First we locate the CCB and take a message buffer off the free buffer queue. \u00a0If no free buffers are available we abend.<\/p>\n<pre>000028 D703 9000 9000 00000 00000    37          XC    CMBNEXT,CMBNEXT    CLEAR FWD CHAIN PTR\r\n00002E 181B                          38          LR    R1,R11             COPY\r\n000030 182B                          39          LR    R2,R11                 PARM VALUE\r\n000032 8810 0018      00018          40          SRL   R1,24              SHIFT DOWN TO GET LENGTH\r\n000036 1211                          41          LTR   R1,R1              CHECK LENGTH\r\n000038 4780 C0AA      000AA          42          BZ    WTO920               ERROR IF ZERO\r\n                                     43 *\r\n00003C 5910 C0C0      000C0          44          C     R1,=F'79'          CHECK MAX LENGTH \r\n000040 4740 C048      00048          45          BL    WTO020\r\n                                     46 *\r\n\f000044 4110 004F      0004F          47          LA    R1,79\r\n000048                               48 WTO020   DS    0H \r\n000048 0610                          49          BCTR  R1,0               SUBTRACT ONE FOR EX\r\n00004A 9240 9004      00004          50          MVI   CMBTEXT,C' '       CLEAR OUT MESSAGE BUFFER\r\n00004E D24D 9005 9004 00005 00004    51          MVC   CMBTEXT+1(L'CMBTEXT-1),CMBTEXT\r\n000054 4410 C094      00094          52          EX    R1,WTOEX           COPY IN TEXT<\/pre>\n<p>The message text is copied into the free buffer.<\/p>\n<pre>000058                               54 WTO030   DS    0H \r\n000058 4120 A004      00004          55          LA    R2,CCBMBQ          CONSOLE MESSAGE QUEUE\r\n00005C                               56 WTO040   DS    0H \r\n00005C 5810 2000      00000          57          L     R1,0(,R2)          NEXT ELEMENT\r\n000060 1211                          58          LTR   R1,R1\r\n000062 4780 C06C      0006C          59          BZ    WTO050             BRANCH IF LAST ELEMENT \r\n                                     60 * \r\n000066 1821                          61          LR    R2,R1              NEXT ELEMENT \r\n000068 47F0 C05C      0005C          62          B     WTO040\r\n                                     63 * \r\n00006C                               65 WTO050   DS    0H \r\n00006C BA19 2000      00000          66          CS    R1,R9,0(R2)        ADD TO CHAIN\r\n000070 4770 C058      00058          67          BNZ   WTO030             GO TRY AGAIN<\/pre>\n<p>The free buffer is placed on the message queue at the end of the chain.<\/p>\n<pre>000074 9140 A00C      0000C          69          TM    CCBECB,X'40'       ECB ALREADY POSTED ?\r\n000078 4710 C08A      0008A          70          BO    WTO060               YES - SKIP POST\r\n                                     71 * \r\n00007C 4110 A00C      0000C          72          LA    R1,CCBECB\r\n                                     73          @CALL POST\r\n000080 58F0 0014      00014          74+         L     R15,20             MVT ADDRESS \r\n000084 58F0 F028      00028          75+         L     R15,MVTPOST-@MVT(,R15) ROUTINE ADDRESS \r\n000088 05EF                          76+         BALR  R14,R15\r\n                                     77 * \r\n00008A                               78 WTO060   DS    0H \r\n                                     79          @CALL EXIT \r\n00008A 58F0 0014      00014          80+         L     R15,20             MVT ADDRESS\r\n00008E 58F0 F024      00024          81+         L     R15,MVTEXIT-@MVT(,R15) ROUTINE ADDRESS\r\n000092 05EF                          82+         BALR  R14,R15 \r\n                                     84 * \r\n000094 D200 9004 B000 00004 00000    85 WTOEX    MVC   CMBTEXT(0),0(R11)  EXECUTED MOVE<\/pre>\n<p>If the ECB is already posted we can go ahead and exit now. \u00a0If the ECB is not posted we call the Post routine to post it and then we exit the SVC.<\/p>\n<pre>00009A                               88 WTO900   DS    0H \r\n00009A 4110 0123      00123          89          LA    R1,X'123'          NO CONSOLE DEFINED\r\n00009E 47F0 C0B2      000B2          90          B     WTO999\r\n                                     91 *\r\n0000A2                               92 WTO910   DS    0H \r\n0000A2 4110 0223      00223          93          LA    R1,X'223'\r\n0000A6 47F0 C0B2      000B2          94          B     WTO999 \r\n                                     95 *\r\n0000AA                               96 WTO920   DS    0H\r\n\f0000AA 4110 0323      00323          97          LA    R1,X'323'\r\n0000AE 47F0 C0B2      000B2          98          B     WTO999\r\n                                     99 * \r\n0000B2                              100 WTO999   DS    0H \r\n                                    101          @CALL ABEND \r\n0000B2 58F0 0014      00014         102+         L     R15,20             MVT ADDRESS\r\n0000B6 58F0 F020      00020         103+         L     R15,MVTABEND-@MVT(,R15) ROUTINE ADDRESS\r\n0000BA 05EF                         104+         BALR  R14,R15<\/pre>\n<p>Here are the various abend codes if something goes wrong.<\/p>\n<p>[Next &#8211; ]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will create the WTO SVC to queue messages to the console. \u00a0When the SVC is called Register 1 contains the address of the message in the bottom three bytes (24 bit address) and the high order byte contains the &hellip; <a href=\"https:\/\/tommysprinkle.com\/txxos\/?p=424\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"template-page-builder-no-sidebar.php","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1CPQT-6Q","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=424"}],"version-history":[{"count":2,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":426,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions\/426"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}