home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxapi.zip / REXXAPI.INF (.txt)
OS/2 Help File  |  1995-11-01  |  118KB  |  4,467 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Notices ΓòÉΓòÉΓòÉ
  3.  
  4. First Edition (December 1991) 
  5.  
  6. The following paragraph does not apply to the United Kingdom or any country 
  7. where such provisions are inconsistent with local law:  INTERNATIONAL BUSINESS 
  8. MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY 
  9. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  10. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states 
  11. do not allow disclaimer of express or implied warranties in certain 
  12. transactions, therefore, this statement may not apply to you. 
  13.  
  14. This publication could include technical inaccuracies or typographical errors. 
  15. Changes are periodically made to the information herein; these changes will be 
  16. incorporated in new editions of the publication. IBM may make improvements 
  17. and/or changes in the product(s) and/or the program(s) described in this 
  18. publication at any time. 
  19.  
  20. It is possible that this publication may contain reference to, or information 
  21. about, IBM products (machines and programs), programming, or services that are 
  22. not announced in your country.  Such references or information must not be 
  23. construed to mean that IBM intends to announce such IBM products, programming, 
  24. or services in your country. 
  25.  
  26. Requests for technical information about IBM products should be made to your 
  27. IBM authorized reseller or IBM marketing representative. 
  28.  
  29.  
  30. ΓòÉΓòÉΓòÉ 1.1. Copyright Notices ΓòÉΓòÉΓòÉ
  31.  
  32. COPYRIGHT LICENSE: This publication contains printed sample application 
  33. programs in source language, which illustrate OS/2 programming techniques. You 
  34. may copy, modify, and distribute these sample programs in any form without 
  35. payment to IBM, for the purposes of developing, using, marketing or 
  36. distributing application programs conforming to the OS/2 application 
  37. programming interface. 
  38.  
  39. Each copy of any portion of these sample programs or any derivative work, which 
  40. is distributed to others, must include a copyright notice as follows: "(C) 
  41. (your company name) (year).  All rights reserved." 
  42.  
  43. (C) Copyright International Business Machines Corporation 1994. All rights 
  44. reserved. 
  45. Note to U.S. Government Users - Documentation related to restricted rights - 
  46. Use, duplication or disclosure is subject to restrictions set forth in GSA ADP 
  47. Schedule Contract with IBM Corp. 
  48.  
  49.  
  50. ΓòÉΓòÉΓòÉ 1.2. Disclaimers ΓòÉΓòÉΓòÉ
  51.  
  52. References in this publication to IBM products, programs, or services do not 
  53. imply that IBM intends to make these available in all countries in which IBM 
  54. operates. Any reference to an IBM product, program or service is not intended 
  55. to state or imply that only IBM's product, program, or service may be used. Any 
  56. functionally equivalent product, program, or service that does not infringe any 
  57. of IBM's intellectual property rights or other legally protectable rights may 
  58. be used instead of the IBM product, program, or service. Evaluation and 
  59. verification of operation in conjunction with other products, programs, or 
  60. services, except those expressly designated by IBM, are the user's 
  61. responsibility. 
  62.  
  63. IBM may have patents or pending patent applications covering subject matter in 
  64. this document. The furnishing of this document does not give you any license to 
  65. these patents. You can send license inquiries, in writing, to the IBM Director 
  66. of Licensing, IBM Corporation, 500 Columbus Avenue, Thornwood NY 10594, U.S.A. 
  67.  
  68.  
  69. ΓòÉΓòÉΓòÉ 1.3. Trademarks ΓòÉΓòÉΓòÉ
  70.  
  71. The following terms, denoted by an asterisk (*) in this publication, are 
  72. trademarks of the IBM Corporation in the United States or other countries: 
  73.  
  74. IBM
  75. PM
  76. Presentation Manager
  77. OS/2
  78. SAA
  79. System Application Architecture
  80. Workplace Shell
  81.  
  82. The following terms, denoted by a double asterisk (**) in this publication, are 
  83. trademarks of other companies as follows. Other trademarks are trademarks of 
  84. their respective companies. 
  85.  
  86.  C++                 AT&T, Inc. 
  87.  Helvetica           Linotype 
  88.  
  89.  
  90. ΓòÉΓòÉΓòÉ 2. How to Use the Program Reference ΓòÉΓòÉΓòÉ
  91.  
  92. The REXX Program Reference is a detailed technical reference for application 
  93. programmers.  It gives reference information and code examples to enable you to 
  94. write source code using REXX Program functions. 
  95.  
  96. Before you begin to use this information, it would be helpful to understand how 
  97. you can: 
  98.  
  99.      Expand the Contents to see all available topics 
  100.      Obtain additional information for a highlighted word or phrase 
  101.      Use action bar choices 
  102.      Use the programming information. 
  103.  
  104.  How to Use the Contents 
  105.  
  106.  When the Contents window first appears, some topics have a plus (+) sign 
  107.  beside them. The plus sign indicates that additional topics are available. 
  108.  
  109.  To expand the Contents if you are using a mouse, click on the plus sign.  If 
  110.  you are using the keyboard, use the Up or Down Arrow key to highlight the 
  111.  topic, and press the plus (+) key. For example, File System has a plus sign 
  112.  beside it. To see additional topics for that heading, click on the plus sign 
  113.  or highlight that topic and press the plus (+) key. 
  114.  
  115.  To view a topic, double-click on the topic (or press the Up or Down Arrow key 
  116.  to highlight the topic, and then press the Enter key). 
  117.  
  118.  How to Obtain Additional Information 
  119.  
  120.  After you select a topic, the information for that topic appears in a window. 
  121.  Highlighted words or phrases indicate that additional information is 
  122.  available. You will notice that certain words and phrases are highlighted in 
  123.  green letters, or in white letters on a black background.  These are called 
  124.  hypertext terms. If you are using a mouse, double-click on the highlighted 
  125.  word.  If you are using a keyboard, press the Tab key to move to the 
  126.  highlighted word, and then press the Enter key.  Additional information then 
  127.  appears in a window. 
  128.  
  129.  How to Use Action Bar Choices 
  130.  
  131.  Several choices are available for managing information presented in the OS/2* 
  132.  2.0 Control Program Reference.  There are three pull-down menus on the action 
  133.  bar:  the Services menu, the Options menu, and the Help menu. 
  134.  
  135.  The actions that are selectable from the Services menu operate on the active 
  136.  window currently displayed on the screen. These actions include the following: 
  137.  
  138.  Bookmark 
  139.     Allows you to set a placeholder so you can retrieve information of interest 
  140.     to you. 
  141.  
  142.     When you place a bookmark on a topic, it is added to a list of bookmarks 
  143.     you have previously set.  You can view the list, and you can remove one or 
  144.     all bookmarks from the list.  If you have not set any bookmarks, the list 
  145.     is empty. 
  146.  
  147.     To set a bookmark, do the following: 
  148.  
  149.       1. Select a topic from the Contents. 
  150.  
  151.       2. When that topic appears, choose the Bookmark option from the Services 
  152.          pull-down. 
  153.  
  154.       3. If you want to change the name used for the bookmark, type the new 
  155.          name in the field. 
  156.  
  157.       4. Click on the Place radio button (or press the Up or Down Arrow key to 
  158.          select it). 
  159.  
  160.       5. Click on OK (or select it and press Enter). The bookmark is then added 
  161.          to the bookmark list. 
  162.  
  163.  Search 
  164.     Allows you to find occurrences of a word or phrase in the current topic, 
  165.     selected topics, or all topics. 
  166.  
  167.     You can specify a word or phrase to be searched.  You can also limit the 
  168.     search to a set of topics by first marking the topics in the Contents list. 
  169.  
  170.     To search for a word or phrase in all topics, do the following: 
  171.  
  172.       1. Choose the Search option from the Services pull-down. 
  173.  
  174.       2. Type the word or words to be searched for. 
  175.  
  176.       3. Click on All sections (or press the Up or Down Arrow keys to select 
  177.          it). 
  178.  
  179.       4. Click on Search (or select it and press Enter) to begin the search. 
  180.  
  181.       5. The list of topics where the word or phrase appears is displayed. 
  182.  
  183.  Print 
  184.     Allows you to print one or more topics.  You can also print a set of topics 
  185.     by first marking the topics in the Contents list. 
  186.  
  187.     To print the document Contents list, do the following: 
  188.  
  189.       1. Choose Print from the Services pull-down. 
  190.  
  191.       2. Click on Contents (or press the Up or Down Arrow key to select it). 
  192.  
  193.       3. Click on Print (or select it and press Enter). 
  194.  
  195.       4. The Contents list is printed on your printer. 
  196.  
  197.  Copy 
  198.     Allows you to copy a topic that you are viewing to the System Clipboard or 
  199.     to a file that you can edit. You will find this particularly useful for 
  200.     copying syntax definitions and program samples into the application that 
  201.     you are developing. 
  202.  
  203.     You can copy a topic that you are viewing in two ways: 
  204.  
  205.         Copy copies the topic that you are viewing into the System Clipboard. 
  206.          If you are using a Presentation Manager* (PM) editor (for example, the 
  207.          System Editor) that copies or cuts (or both) to the System Clipboard, 
  208.          and pastes to the System Clipboard, you can easily add the copied 
  209.          information to your program source module. 
  210.  
  211.         Copy to file copies the topic that you are viewing into a temporary 
  212.          file named TEXT.TMP.  You can later edit that file by using any 
  213.          editor.  You will find TEXT.TMP in the directory where your viewable 
  214.          document resides. 
  215.  
  216.          To copy a topic, do the following: 
  217.  
  218.            1. Expand the Contents list and select a topic. 
  219.  
  220.            2. When the topic appears, choose Copy to file from the Services 
  221.               pull-down. 
  222.  
  223.            3. The system puts the text pertaining to that topic into the 
  224.               temporary file named TEXT.TMP. 
  225.  
  226.     For information on one of the other choices in the Services pull-down, 
  227.     highlight the choice and press the F1 key. 
  228.  
  229.  The actions that are selectable from the Options menu allow you to change the 
  230.  way your Contents list is displayed. To expand the Contents and show all 
  231.  levels for all topics, choose Expand all from the Options pull-down. You can 
  232.  also press the Ctrl and * keys together. For information on one of the other 
  233.  choices in the Options pull-down, highlight the choice and press the F1 key. 
  234.  
  235.  The actions that are selectable from the Help menu allow you to select 
  236.  different types of help information.  You can also press the F1 key for help 
  237.  information about the Information Presentation Facility (IPF). 
  238.  
  239.  How to Use the Programming Information 
  240.  
  241.  The REXX Program Reference consists of reference information that provides a 
  242.  detailed description of each REXX function. 
  243.  
  244.  REXX Program programming information is presented by component, such as 
  245.  Subcommmand Interface Functions, System Exit Functions and Macrospace 
  246.  Functions, for example: 
  247.  
  248.        ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  249.        Γöé            Contents                     Γöé
  250.        Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  251.        Γöé                                         Γöé
  252.        Γöé  + Subcommand Interface Functions       Γöé
  253.        Γöé  + System Exit Functions                Γöé
  254.        Γöé  + Macrospace Functions                 Γöé
  255.        Γöé                                         Γöé
  256.        ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  257.  
  258.  By clicking on the plus sign beside 'Subcommand Interface Functions', you see 
  259.  an alphabetic list of the REXX functions for the subcommand interface. 
  260.  Selecting a function takes you directly into the reference information for 
  261.  that function. 
  262.  
  263.  Units of reference information are presented in selectable multiple windows or 
  264.  viewports. A viewport is a Presentation Manager window that can be sized, 
  265.  moved, minimized, maximized, or closed.  By selecting a unit (in this case, an 
  266.  entry on the Contents list), you will see two windows displayed: 
  267.  
  268.       ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  269.       Γöé Unit Title    Γöé   Selection Title           Γöé
  270.       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  271.       Γöé Select one:   Γöé                             Γöé
  272.       Γöé    .          Γöé                             Γöé
  273.       Γöé    .          Γöé                             Γöé
  274.       Γöé    .          Γöé                             Γöé
  275.       Γöé Return Values Γöé                             Γöé
  276.       Γöé Errors        Γöé                             Γöé
  277.       Γöé Notes         Γöé                             Γöé
  278.       Γöé               Γöé                             Γöé
  279.       Γöé               Γöé                             Γöé
  280.       ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  281.  
  282.  The window on the left is the primary window.  It contains a list of items 
  283.  that are always available to you.  The window on the right is the secondary 
  284.  window.  It contains a 'snapshot' of the unit information. For reference units 
  285.  (that is, function descriptions), this window contains the Call Syntax. 
  286.  
  287.  All of the information needed to understand a reference unit (or topic) is 
  288.  readily available to you through the primary window. The information is 
  289.  divided into discrete information groups, and only the appropriate information 
  290.  group appears for the topic that you are viewing. 
  291.  
  292.  The information groups for a reference unit (that is, a function description) 
  293.  can include the following: 
  294.  
  295.      Call Syntax 
  296.      Uses 
  297.      Parameters 
  298.      Data Structures 
  299.      Return Values 
  300.      Errors 
  301.      Notes 
  302.      Related Functions 
  303.      Examples 
  304.      Sample Programs 
  305.  
  306.  This list may vary.  Uses, Data Structures, Notes, Related Functions, 
  307.  Examples, and Sample Programs may be omitted when they do not apply. In other 
  308.  instances, information may be added when appropriate. For example, when 
  309.  viewing the RexxStart function, you will see the Data Structures topic and the 
  310.  Examples topic in the primary window. 
  311.  
  312.  Information groups are displayed in separate viewports that are stacked in a 
  313.  third window location that overlaps the secondary window. By selecting an item 
  314.  (information group) in the primary window, the item is displayed in the third 
  315.  window location: 
  316.  
  317.     ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  318.     Γöé Unit Title   Γöé   Selection TiΓöé   Data Types  Γöé
  319.     Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  320.     Γöé Select one:  Γöé               Γöé  BOOL         Γöé
  321.     Γöé              Γöé               Γöé  BYTE         Γöé
  322.     Γöé    .         Γöé               Γöé  CHAR         Γöé
  323.     Γöé    .         Γöé               Γöé    .          Γöé
  324.     Γöé    .         Γöé               Γöé    .          Γöé
  325.     Γöé Data Types   Γöé               Γöé    .          Γöé
  326.     Γöé Errors       Γöé               Γöé               Γöé
  327.     Γöé              Γöé               Γöé               Γöé
  328.     Γöé              Γöé               Γöé               Γöé
  329.     Γöé              Γöé               Γöé               Γöé
  330.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  331.  
  332.  By selecting successive items from the primary window, additional windows are 
  333.  displayed on top of the previous windows displayed in the third window 
  334.  location.  For example, in a function description, Parameters and Return 
  335.  Values are items listed in the primary window.  When selected, they appear one 
  336.  on top of the other in the third window location. Because of this, you may 
  337.  move the first selected (topmost) window to the left before selecting the next 
  338.  item. This allows simultaneous display of two related pieces of information 
  339.  from the 'stack' of windows in the third window location: 
  340.  
  341.     ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  342.     Γöé Unit Title    Γöé  Parameters   Γöé Return Values Γöé
  343.     Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  344.     Γöé Select one:   Γöé               Γöé  RXSUBCOM_NOERΓöé
  345.     Γöé    .          Γöé               Γöé  RXSUBCOM_NOTRΓöé
  346.     Γöé    .          Γöé               Γöé  RXSUBCOM_NOEMΓöé
  347.     Γöé    .          Γöé               Γöé  RXSUBCOM_BADTΓöé
  348.     Γöé Parameters    Γöé               Γöé    .          Γöé
  349.     Γöé Return Values Γöé               Γöé    .          Γöé
  350.     Γöé Errors        Γöé               Γöé    .          Γöé
  351.     Γöé Examples      Γöé               Γöé               Γöé
  352.     Γöé               Γöé               Γöé               Γöé
  353.     Γöé               Γöé               Γöé               Γöé
  354.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  355.  
  356.  Each window can be individually closed from its system menu.  All windows are 
  357.  closed when you close the primary window. 
  358.  
  359.  Some secondary windows may have the appearance of a split screen. For example, 
  360.  an illustration may appear in the left half of the window, and scrollable, 
  361.  explanatory information may appear in the right half of the window.  Because 
  362.  illustrations may not necessarily fit into the small window size on your 
  363.  screen, you may maximize the secondary window for better readability. 
  364.  
  365.  
  366. ΓòÉΓòÉΓòÉ <hidden> IBM Trademark ΓòÉΓòÉΓòÉ
  367.  
  368. Trademark of the IBM Corporation. 
  369.  
  370.  
  371. ΓòÉΓòÉΓòÉ 3. REXX Functions ΓòÉΓòÉΓòÉ
  372.  
  373. The following functions can interface with the REXX interpreter: 
  374.  
  375.       RexxAddMacro 
  376.       RexxClearMacroSpace 
  377.       RexxDeregisterExit 
  378.       RexxDeregisterFunction 
  379.       RexxDeregisterSubcom 
  380.       RexxDropMacro 
  381.       RexxLoadMacroSpace 
  382.       RexxQueryExit 
  383.       RexxQueryFunction 
  384.       RexxQueryMacro 
  385.       RexxQuerySubcom 
  386.       RexxRegisterExitExe 
  387.       RexxRegisterExitDll 
  388.       RexxRegisterFunctionExe 
  389.       RexxRegisterFunctionDll 
  390.       RexxRegisterSubcomExe 
  391.       RexxRegisterSubcomDll 
  392.       RexxReorderMacro 
  393.       RexxResetTrace 
  394.       RexxSaveMacroSpace 
  395.       RexxSetHalt 
  396.       RexxSetTrace 
  397.       RexxStart 
  398.       RexxVariablePool 
  399.  
  400.  
  401. ΓòÉΓòÉΓòÉ 4. Using REXX Interfaces ΓòÉΓòÉΓòÉ
  402.  
  403. This chapter is addressed mainly to professional systems and application 
  404. programmers. It describes: 
  405.  
  406.      RXSTRINGs 
  407.      Invoking the REXX Interpreter 
  408.      Subcommand Handlers 
  409.      External Functions 
  410.      System Exits 
  411.      Variable Pool Interface 
  412.      Macrospace Interface 
  413.      Halt and Trace Functions 
  414.  
  415.  In this chapter, the term application refers to programs written in languages 
  416.  other than REXX. The features described here allow an application to extend 
  417.  many parts of the REXX language or extend an application with REXX. This 
  418.  includes creating handlers for subcommands, external functions and system 
  419.  exits. 
  420.  
  421.  Subcommands Commands issued from a REXX program. A REXX expression is 
  422.             evaluated and the result is passed as a command to the currently 
  423.             "addressed" subcommand handler. Subcommands are used in REXX 
  424.             programs running as application macros. 
  425.  
  426.  Functions  Direct extensions of the REXX language. An application can create 
  427.             functions that extend the native REXX function set. Functions may 
  428.             be general purpose extensions or specific to an application. 
  429.  
  430.  System Exits Create programmer-defined variations of the operating system. The 
  431.             application programmer can tailor the REXX interpreter behavior by 
  432.             replacing the OS/2* operating system for REXX system requests. 
  433.  
  434.  Subcommand, function and exit handlers have similar coding, compilation and 
  435.  packaging characteristics. 
  436.  
  437.  In addition, applications can manipulate the variables in REXX programs (the 
  438.  Variable Pool Interface), and execute REXX routines directly from memory (the 
  439.  Macrospace Interface). 
  440.  
  441.  
  442. ΓòÉΓòÉΓòÉ 4.1. General Characteristics ΓòÉΓòÉΓòÉ
  443.  
  444. The basic requirements for subcommand, function and system exit handlers are: 
  445.  
  446.      REXX handlers must use the system linkage convention. Handler functions 
  447.       must be declared with the appropriate type definition from the REXXSAA.H 
  448.       include file: 
  449.  
  450.         -  RexxSubcomHandler 
  451.         -  RexxFunctionHandler 
  452.         -  RexxExitHandler 
  453.  
  454.      A REXX handler must be packaged as either: 
  455.  
  456.         -  An exported routine within a Dynamic Link Library (a dynalink or 
  457.            DLL) 
  458.         -  An entry point within an executable (EXE) module. 
  459.  
  460.      A handler must be registered with REXX before it can be used. REXX uses 
  461.       the registration information to locate and call the handler. For example, 
  462.       external function registration of a dynamic link library external 
  463.       function identifies both the dynamic link library and routine that 
  464.       contains the external function. Also note: 
  465.  
  466.         -  Dynamic link library handlers are global to the OS/2* operating 
  467.            system; they can be used by any REXX program. 
  468.  
  469.         -  EXE file handlers are local to the registering process; handlers 
  470.            packaged within an EXE module can only be used by a REXX program 
  471.            running in the same process as the EXE module. 
  472.  
  473.  
  474. ΓòÉΓòÉΓòÉ 5. RXSTRINGs ΓòÉΓòÉΓòÉ
  475.  
  476. Many of the REXX interfaces pass REXX character strings to and from a REXX 
  477. procedure. The RXSTRING data structure is used to describe REXX character 
  478. strings. An RXSTRING is a content-insensitive, flat model character string with 
  479. a theoretical maximum length of 4 gigabytes. The following structure defines an 
  480. RXSTRING: 
  481.  
  482.  
  483. RXSTRING Data Structure
  484.  
  485. typedef struct {
  486.    ULONG           strlength;          /*   length of string          */
  487.    PCH             strptr;             /*   pointer to string         */
  488. } RXSTRING;
  489.  
  490. typedef RXSTRING *PRXSTRING;           /* pointer to an RXSTRING       */
  491.  
  492.    1. The REXXSAA.H include file contains a number of convenient macros for 
  493.       setting and testing RXSTRING values. 
  494.  
  495.    2. An RXSTRING can have a value (including the null string, "") or it can be 
  496.       empty. 
  497.  
  498.           If an RXSTRING has a value, the strptr field will be non-NULL. The 
  499.            RXSTRING macro RXVALIDSTRING(string) will return TRUE. 
  500.  
  501.           If an RXSTRING is the REXX null string (""), the strptr field will 
  502.            be non-NULL and the strlength field will be 0. The RXSTRING macro 
  503.            RXZEROLENSTRING(string) will return TRUE. 
  504.  
  505.           If an RXSTRING is empty, the field strptr will be NULL. The RXSTRING 
  506.            macro RXNULLSTRING(string) will return TRUE. 
  507.  
  508.    3. When the REXX interpreter passes an RXSTRING to a subcommand handler, 
  509.       external function, or exit handler, the interpreter adds a null character 
  510.       (hexadecimal zero) at the end of the RXSTRING data. The C string library 
  511.       functions can be used on these strings. However, the RXSTRING data can 
  512.       also contain null characters. There is no guarantee that the first null 
  513.       character encountered in an RXSTRING marks the end of the string. The C 
  514.       string functions should only be used when null characters are not 
  515.       expected in the RXSTRINGs (such a file names passed to external 
  516.       functions). The strlength field in the RXSTRING does not include the 
  517.       terminating null character. 
  518.  
  519.    4. When the REXX interpreter calls subcommand handlers, external functions, 
  520.       and some exit handlers, the interpreter expects an RXSTRING value 
  521.       returned. The interpreter provides a default RXSTRING with a strlength of 
  522.       256 for the returned information. If the returned data is shorter than 
  523.       256 characters, the handler can copy the data into the default RXSTRING 
  524.       and set the strlength field to the length returned. 
  525.  
  526.       If the returned data is longer than 256 characters, a new RXSTRING can be 
  527.       allocated using "DosAllocMem". The strptr field must point to the new 
  528.       storage and the strlength must be set to the string length. The REXX 
  529.       interpreter will return the newly allocated storage to the system for the 
  530.       handler routine. 
  531.  
  532.  
  533. ΓòÉΓòÉΓòÉ 6. Invoking the REXX Interpreter ΓòÉΓòÉΓòÉ
  534.  
  535. A REXX program can be executed directly by the operating system or from within 
  536. an application program. 
  537.  
  538.  
  539. ΓòÉΓòÉΓòÉ 6.1. From the Operating System ΓòÉΓòÉΓòÉ
  540.  
  541. The CMD.EXE command shell calls the REXX interpreter for the user: 
  542.  
  543.      at command prompts 
  544.  
  545.      in calls from CMD (batch) files 
  546.  
  547.       Note:  Use the OS/2* operating system CALL command to invoke a REXX 
  548.              program in a batch file if you want control to return to the 
  549.              caller. 
  550.  
  551.      from the object that represents the program on the OS/2 operating system 
  552.       Desktop. 
  553.  
  554.  
  555. ΓòÉΓòÉΓòÉ 6.2. From Within an Application ΓòÉΓòÉΓòÉ
  556.  
  557. The REXX interpreter is a dynamic link library (DLL) routine. Any application 
  558. can call the REXX interpreter to execute a REXX program. The interpreter is 
  559. fully re-entrant and supports REXX procedures running on multiple threads 
  560. within the same process. 
  561.  
  562. A C-language prototype for the RexxStart function in the Developer's Toolkit 
  563. REXXSAA.H include file. 
  564.  
  565.  
  566. ΓòÉΓòÉΓòÉ 6.3. RexxStart ΓòÉΓòÉΓòÉ
  567.  
  568.  
  569. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  570.  
  571. Topics: 
  572.  
  573.       Call Syntax 
  574.       Uses 
  575.       Parameters 
  576.       Data Structures 
  577.       Return Values 
  578.       Notes 
  579.       Related Functions 
  580.       Examples 
  581.  
  582.  
  583. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxStart ΓòÉΓòÉΓòÉ
  584.  
  585. /*******************************************/
  586. /* RexxStart invokes the REXX interpreter */
  587. /*  to execute a REXX procedure.           */
  588. /*******************************************/
  589.  
  590. LONG      return_code;  /* interpreter return code    */
  591. RXSTRING  argv[1];      /* program argument string    */
  592. RXSTRING  retstr;       /* program return value       */
  593. LONG      rc;           /* converted return code      */
  594.  
  595. return_code = RexxStart(1,
  596.                        argv,
  597.                        "CHANGE.ED",
  598.                        NULL,
  599.                        "Editor",
  600.                        RXCOMMAND,
  601.                        NULL,
  602.                        &rc,
  603.                        &retstr);
  604.  
  605.  
  606. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxStart ΓòÉΓòÉΓòÉ
  607.  
  608. RexxStart invokes the REXX interpreter to execute a REXX procedure. 
  609.  
  610.  
  611. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxStart ΓòÉΓòÉΓòÉ
  612.  
  613. RexxStart  (ArgCount, ArgList, ProgramName, Instore, EnvName, CallType, Exits, 
  614. ReturnCode, Result) 
  615.  
  616. Parameters: 
  617.  
  618.  ArgCount (LONG) - input 
  619.     The number of elements in the ArgList array. This is the value that will be 
  620.     returned by the ARG() built-in function in the REXX program. ArgCount 
  621.     includes RXSTRINGs which represent omitted arguments. Omitted arguments 
  622.     will be empty RXSTRINGs (strptr will be NULL). 
  623.  
  624.  ArgList (PRXSTRING) - input 
  625.     An array of RXSTRING structures that are the REXX program arguments. 
  626.  
  627.  ProgramName (PSZ) - input 
  628.     Address of the ASCIIZ name of the REXX procedure. If Instore is NULL, 
  629.     string must contain at least the file name of the REXX procedure. An 
  630.     extension, drive, and path specification can also be provided. If a file 
  631.     extension is not specified, a default of ".CMD" is supplied. A REXX program 
  632.     can use any extension. If the path and drive are not provided, the REXX 
  633.     interpreter uses the normal OS/2* operating system file search (current 
  634.     directory, then environment path). 
  635.  
  636.     If Instore is not NULL, ProgramName is the name used in the PARSE SOURCE 
  637.     instruction. If Instore requests a REXX procedure from the macrospace, 
  638.     ProgramName is the macrospace function name. (see Macrospace Interface). 
  639.  
  640.  Instore (PRXSTRING) - input 
  641.     An array of two RXSTRING descriptors for in-storage REXX procedures. If the 
  642.     strptr fields of both RXSTRINGs are NULL, the interpreter searches for REXX 
  643.     procedure ProgramName in the REXX macrospace (see Macrospace Interface). If 
  644.     the procedure is not in the macrospace, the RexxStart function terminates 
  645.     with an error return code. 
  646.  
  647.     If either Instore strptr field is not NULL, Instore is used to execute a 
  648.     REXX procedure directly from storage. 
  649.  
  650.     Instore[0] 
  651.             An RXSTRING describing a memory buffer containing the REXX 
  652.             procedure source. The source must be an exact image of a REXX 
  653.             procedure disk file (complete with carriage returns, line feeds, 
  654.             and end-of-file characters). 
  655.  
  656.     Instore[1] 
  657.             An RXSTRING containing the tokenized image of the REXX procedure. 
  658.             If Instore[1] is empty, the REXX interpreter will return the 
  659.             tokenized image in Instore[1] when the REXX procedure finishes 
  660.             executing. The tokenized image can be used in Instore[1] on 
  661.             subsequent RexxStart function calls. 
  662.  
  663.             If Instore[1] is not empty, interpreter will execute the tokenized 
  664.             image directly. The program source provided in Instore[0] is only 
  665.             used if the REXX procedure uses the SOURCELINE built-in function. 
  666.             Instore[0] can be empty if SOURCELINE is not used. If Instore[0] is 
  667.             empty and the SOURCELINE built-in function is used, SOURCELINE will 
  668.             return null strings for the REXX procedure source lines. 
  669.  
  670.             If Instore[1] is not empty, but does not contain a valid REXX 
  671.             tokenized image, unpredictable results can occur. The REXX 
  672.             interpreter might be able to determine that the tokenized image is 
  673.             incorrect and retokenize the source. 
  674.  
  675.             Instore[1] is both an input and an output parameter. 
  676.  
  677.     If the procedure is executed from disk, the Instore pointer must be NULL. 
  678.     If the first argument string in Arglist contains the string "//T" and the 
  679.     CallType is RXCOMMAND, the interpreter will tokenize the procedure source 
  680.     and return the tokenized image without running the program. 
  681.  
  682.     The program using the RexxStart function must release Instore[1] using 
  683.     "DosFreeMem" when the tokenized image is no longer needed. 
  684.  
  685.     The format of the tokenized image of a REXX program is not a programming 
  686.     interface. The tokenized image can only be executed by the same interpreter 
  687.     version used to create the image. Therefore, a tokenized image must not be 
  688.     moved to other systems or saved for later use. The tokenized image can, 
  689.     however, be used multiple times during a single application instance. 
  690.  
  691.  EnvName (PSZ) - input 
  692.     Address of the ASCIIZ initial ADDRESS environment name. The ADDRESS 
  693.     environment is a subcommand handler registered using RexxRegisterSubcomExe 
  694.     or RexxRegisterSubcomDll, EnvName is used as the initial setting for the 
  695.     REXX ADDRESS instruction. 
  696.  
  697.     If EnvName is NULL, the file extension is used as the initial ADDRESS 
  698.     environment. The environment name cannot be longer than 250 characters. 
  699.  
  700.  CallType (LONG) - input 
  701.     The type of REXX procedure execution. Allowed execution types are: 
  702.  
  703.     RXCOMMAND 
  704.             The REXX procedure is an OS/2 operating system command or 
  705.             application command. REXX commands normally have a single argument 
  706.             string. The REXX PARSE SOURCE instruction will return COMMAND as 
  707.             the second token. 
  708.  
  709.     RXSUBROUTINE 
  710.             The REXX procedure is a subroutine of another program. The 
  711.             subroutine can have multiple arguments and does not need to return 
  712.             a result. The REXX PARSE SOURCE instruction will return SUBROUTINE 
  713.             as the second token. 
  714.  
  715.     RXFUNCTION 
  716.             The REXX procedure is a function called from another program. The 
  717.             subroutine can have multiple arguments and must return a result. 
  718.             The REXX PARSE SOURCE instruction will return FUNCTION as the 
  719.             second token. 
  720.  
  721.  Exits (PRXSYSEXIT) - input 
  722.     An array of RXSYSEXIT structures defining exits the REXX interpreter will 
  723.     use. The RXSYSEXIT structures have the following form: 
  724.  
  725.  
  726.         RXSYSEXIT Data Structure
  727.  
  728.         typedef struct {
  729.            PSZ             sysexit_name;       /* name of exit handler        */
  730.            LONG            sysexit_code;       /* system exit function code   */
  731.         } RXSYSEXIT;
  732.  
  733.     The sysexit_name is the address of an ASCIIZ exit handler name registered 
  734.     with RexxRegisterExitExe or RexxRegisterExitDll. sysexit_code is a code 
  735.     identifying the handler exit type. See System Exits for exit code 
  736.     definitions. The system exit list end is identified by an RXENDLST entry. 
  737.     Exits must be NULL if exits are not used. 
  738.  
  739.  ReturnCode (PLONG) - output 
  740.     The integer form of the Result string. If the Result string is a whole 
  741.     number in the range -(2**15) to 2**15-1, it will be converted to an integer 
  742.     and and also returned in ReturnCode. 
  743.  
  744.  Result (PRXSTRING) - output 
  745.     The string returned from the REXX procedure with the REXX RETURN or EXIT 
  746.     instruction. A default RXSTRING can be provided for the returned result. If 
  747.     a default RXSTRING is not provided or the default is too small for the 
  748.     returned result, the REXX interpreter will allocate an RXSTRING using 
  749.     "DosAllocMem". The caller of the RexxStart function must release the 
  750.     RXSTRING storage with "DosFreeMem". 
  751.  
  752.     The REXX interpreter does not add a terminating null to Result. 
  753.  
  754.  
  755. ΓòÉΓòÉΓòÉ <hidden> Data Structures - RexxStart ΓòÉΓòÉΓòÉ
  756.  
  757. RexxStart uses the following data structures: 
  758.  
  759. typedef struct {
  760.    ULONG           strlength;          /*   length of string         */
  761.    PCH             strptr;             /*   pointer to string        */
  762. } RXSTRING;
  763.  
  764. typedef RXSTRING *PRXSTRING;           /* pointer to an RXSTRING     */
  765.  
  766. typedef struct {
  767.    PSZ             sysexit_name;       /* name of exit handler        */
  768.    LONG            sysexit_code;       /* system exit function code   */
  769. } RXSYSEXIT;
  770.  
  771.  
  772. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxStart ΓòÉΓòÉΓòÉ
  773.  
  774. RexxStart returns the following values: 
  775.  
  776.  negative 
  777.     Interpreter errors. 
  778.  
  779.  0 
  780.     No errors occurred.  The REXX procedure executed normally. 
  781.  
  782.  When a macrospace REXX procedure is not loaded in the macrospace, the return 
  783.  code is -3 ("Program is unreadable"). 
  784.  
  785.  
  786. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxStart ΓòÉΓòÉΓòÉ
  787.  
  788. The REXX interpreter is a dynamic link library (DLL) routine. Any application 
  789. can use the REXX interpreter to execute a REXX program. The interpreter is 
  790. fully re-entrant and supports REXX procedures running on multiple threads 
  791. within the same process. 
  792.  
  793.  
  794. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxStart ΓòÉΓòÉΓòÉ
  795.  
  796. The following functions are related to RexxStart: 
  797.  
  798.       RexxAddMacro 
  799.       RexxRegisterSubcomExe 
  800.       RexxRegisterFunctionExe 
  801.  
  802.  
  803. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxStart ΓòÉΓòÉΓòÉ
  804.  
  805. The following example shows the use of RexxStart: 
  806.  
  807. LONG      return_code;                 /* interpreter return code    */
  808. RXSTRING  argv[1];                     /* program argument string    */
  809. RXSTRING  retstr;                      /* program return value       */
  810. LONG      rc;                          /* converted return code      */
  811. CHAR      return_buffer[250];          /* returned buffer            */
  812.  
  813.                                        /* build the argument string  */
  814.   MAKERXSTRING(argv[0], macro_argument,
  815.       strlen(macro_argument));
  816.                                        /* set up default return      */
  817.   MAKERXSTRING(retstr, return_buffer, sizeof(return_buffer));
  818.  
  819.   return_code = RexxStart(1,           /* one argument               */
  820.                           argv,        /* argument array             */
  821.                           "CHANGE.ED", /* REXX procedure name        */
  822.                           NULL,        /* use disk version           */
  823.                           "Editor",    /* default address name       */
  824.                           RXCOMMAND,   /* calling as a subcommand    */
  825.                           NULL,        /* no exits used              */
  826.                           &rc,         /* converted return code      */
  827.                           &retstr);    /* returned result            */
  828.  
  829.                                        /* process return value       */
  830.            .
  831.            .
  832.            .
  833.                                        /* need to return storage?    */
  834.   if (RXSTRPTR(retval) != return_buffer)
  835.     DosFreeMem(RXSTRPTR(retval));      /* release the RXSTRING       */
  836.  
  837.  
  838. ΓòÉΓòÉΓòÉ 7. Subcommand Interfaces ΓòÉΓòÉΓòÉ
  839.  
  840. An application can create named handlers to process commands from a REXX 
  841. programs. Once created, the subcommand handler name can be used with the 
  842. RexxStart function or the REXX ADDRESS instruction. Subcommand handlers must be 
  843. registered with the RexxRegisterSubcomExe or RexxRegisterSubcomDll function 
  844. before use. 
  845.  
  846.  
  847. ΓòÉΓòÉΓòÉ 7.1. Registering Subcommand Handlers ΓòÉΓòÉΓòÉ
  848.  
  849. A subcommand handler can reside in the same module (EXE or DLL) as an 
  850. application, or it can reside in a separate dynamic link library. An 
  851. application that executes REXX procedures with RexxStart should use 
  852. RexxRegisterSubcomExe to register subcommand handlers. The REXX interpreter 
  853. passes commands to the application subcommand handler entry point. Subcommand 
  854. handlers created using RexxRegisterSubcomExe are available only to REXX 
  855. programs invoked from the registering application. 
  856.  
  857. The RexxRegisterSubcomDll function creates subcommand handlers which reside in 
  858. a dynamic link library. A dynamic link library subcommand handler can be 
  859. accessed by any REXX program using the REXX ADDRESS instruction. A dynamic link 
  860. library subcommand handler can also be registered directly from a REXX program 
  861. using the RXSUBCOM command. 
  862.  
  863.  
  864. ΓòÉΓòÉΓòÉ 7.2. Creating Subcommand Handlers ΓòÉΓòÉΓòÉ
  865.  
  866. The following example is a sample subcommand handler definition. 
  867.  
  868.  
  869. Sample Definition of a Subcommand Handler
  870.  
  871. ULONG command_handler(
  872.   PRXSTRING Command,    /* Command string from REXX                 */
  873.   PUSHORT   Flags,      /* Returned Error/Failure flags             */
  874.   PRXSTRING Retstr)     /* Returned RC string                       */
  875.  
  876. Where: 
  877.  
  878.  Command   The command string created by REXX. 
  879.  
  880.            Command is a null-terminated RXSTRING containing the issued command. 
  881.  
  882.  Flags     Subcommand completion status. The subcommand handler can indicate 
  883.            success, error, or failure status. The subcommand handler can set 
  884.            Flags to one of the following value: 
  885.  
  886.            RXSUBCOM_OK 
  887.                    The subcommand completed normally. No errors occurred during 
  888.                    subcommand processing and the REXX procedure will continue 
  889.                    when the subcommand handler returns. 
  890.  
  891.            RXSUBCOM_ERROR 
  892.                    A subcommand error occurred. RXSUBCOM_ERROR indicates a 
  893.                    subcommand error occurred, for example, incorrect command 
  894.                    options or syntax. 
  895.  
  896.                    If the subcommand handler sets Flags to RXSUBCOM_ERROR, the 
  897.                    REXX interpreter will raise an ERROR condition if SIGNAL ON 
  898.                    ERROR or CALL ON ERROR traps have been created. If TRACE 
  899.                    ERRORS has been issued, REXX will trace the command when the 
  900.                    subcommand handler returns. 
  901.  
  902.            RXSUBCOM_FAILURE 
  903.                    A subcommand failure occurred. RXSUBCOM_FAILURE indicates 
  904.                    that general subcommand processing errors have occurred. For 
  905.                    example, unknown commands normally return RXSUBCOM_FAILURE. 
  906.  
  907.                    If the subcommand handler sets Flags to RXSUBCOM_FAILURE, 
  908.                    the REXX interpreter will raise a FAILUREcondition if SIGNAL 
  909.                    ON FAILURE or CALL ON FAILURE traps have been created. If 
  910.                    TRACE FAILURES has been issued, REXX will trace the command 
  911.                    when the subcommand handler returns. 
  912.  
  913.  Retstr    Address of an RXSTRING for the return code. Retstr is a character 
  914.            string return code that will be assigned to the REXX special 
  915.            variable RC when the subcommand handler returns to REXX. The REXX 
  916.            interpreter provides a default 256-byte RXSTRING in Retstr. A longer 
  917.            RXSTRING can allocated with "DosAllocMem" if the return string is 
  918.            longer than the default RXSTRING. If the subcommand handler sets 
  919.            Retval to an empty RXSTRING (a NULL strptr), REXX will assign the 
  920.            string "0" to RC. 
  921.  
  922.  
  923. ΓòÉΓòÉΓòÉ <hidden> Sample Sucommand Handler ΓòÉΓòÉΓòÉ
  924.  
  925. ULONG Edit_Commands(
  926.   PRXSTRING Command,    /* Command string passed from the caller    */
  927.   PUSHORT   Flags,      /* pointer to short for return of flags     */
  928.   PRXSTRING Retstr)     /* pointer to RXSTRING for RC return        */
  929. {
  930.   LONG      command_id;                /* command to process         */
  931.   LONG      rc;                        /* return code                */
  932.   PSZ       scan_pointer;              /* current command scan       */
  933.   PSZ       target;                    /* general editor target      */
  934.  
  935.   scan_pointer = command->strptr;      /* point to the command       */
  936.                                        /* resolve command            */
  937.   command_id = resolve_command(&scan_pointer);
  938.  
  939.   switch (command_id) {                /* process based on command   */
  940.  
  941.     case   LOCATE:                     /* locate command             */
  942.  
  943.                                        /* validate rest of command   */
  944.       if (rc = get_target(&scan_pointer, &target)) {
  945.         *Flags = RXSUBCOM_ERROR;       /* raise an error condition   */
  946.         break;                         /* return to REXX             */
  947.       }
  948.       rc = locate(target);             /* look target in the file    */
  949.       *Flags = RXSUBCOM_OK;            /* not found is not an error  */
  950.       break;                           /* go finish up               */
  951.  
  952.        .
  953.        .
  954.        .
  955.  
  956.     default:                           /* unknown command            */
  957.       rc = 1;                          /* return code for unknown    */
  958.       *Flags = RXSUBCOM_FAILURE;       /* this is a command failure  */
  959.       break;
  960.   }
  961.  
  962.   sprintf(Retstr->strptr, "%d", rc);   /* format return code string  */
  963.                                        /* and set the correct length */
  964.   Retstr->strlength = strlen(Retstr->strptr);
  965.   return 0;                            /* processing completed       */
  966. }
  967.  
  968.  
  969. ΓòÉΓòÉΓòÉ 8. Subcommand Interface Functions ΓòÉΓòÉΓòÉ
  970.  
  971.      RexxRegisterSubcomDll registers a subcommand handler that resides in a 
  972.       dynamic link library routine. 
  973.  
  974.      RexxRegisterSubcomExe registers a subcommand handler that resides within 
  975.       application code. 
  976.  
  977.      RexxDeregisterSubcom deregisters a subcommand handler. 
  978.  
  979.      RexxQuerySubcom queries a subcommand handler and retrieves saved user 
  980.       information. 
  981.  
  982.  
  983. ΓòÉΓòÉΓòÉ 8.1. RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  984.  
  985.  
  986. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  987.  
  988. Topics: 
  989.  
  990.       Call Syntax 
  991.       Uses 
  992.       Parameters 
  993.       Return Values 
  994.       Errors 
  995.       Notes 
  996.       Related Functions 
  997.       Sample Programs 
  998.  
  999.  
  1000. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1001.  
  1002. /*******************************************/
  1003. /* RexxRegisterSubcomDll registers a      */
  1004. /*  subcommand handler that resides in a   */
  1005. /*  dynamic link library routine.          */
  1006. /*******************************************/
  1007.  
  1008. #define INCL_RXSUBCOM       /* Subcommand handler values */
  1009.  
  1010. PSZ     name;         /* handler name */
  1011. PSZ     library;      /* DLL name     */
  1012. PSZ     routine;      /* routine name */
  1013. ULONG   rc;           /* Return code  */
  1014. ULONG   userdata[2];  /* save userdata*/
  1015.  
  1016. rc = RexxRegisterSubcomDll(name, library, routine,
  1017.      userdata, RXSUBCOM_DROPPABLE);
  1018.  
  1019.  
  1020. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1021.  
  1022. RexxRegisterSubcomDll registers a subcommand handler that resides in a dynamic 
  1023. link library routine. 
  1024.  
  1025.  
  1026. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1027.  
  1028. RexxRegisterSubcomDll (EnvName, ModuleName, EntryPoint, UserArea, DropAuth) 
  1029.  
  1030. Parameters: 
  1031.  
  1032.  EnvName (PSZ) - input 
  1033.     Address of an ASCIIZ subcommand handler name. 
  1034.  
  1035.  ModuleName (PSZ) - input 
  1036.     Address of an ASCIIZ dynamic link library name. ModuleName is the DLL file 
  1037.     containing the subcommand handler routine. 
  1038.  
  1039.  EntryPoint (PSZ) - input 
  1040.     Address of an ASCIIZ dynamic link library procedure name. EntryPoint is the 
  1041.     name of the exported routine within ModuleName that is the REXX subcommand 
  1042.     handler. 
  1043.  
  1044.  UserArea (PUCHAR) - input 
  1045.     Address of an 8-byte area of user defined information. The 8 bytes 
  1046.     addressed by UserArea will be saved with the subcommand handler 
  1047.     registration. UserArea can be NULL if there is no user information to save. 
  1048.     The saved user information can be retrieved with the RexxQuerySubcom 
  1049.     function. 
  1050.  
  1051.  DropAuth (ULONG) - input 
  1052.     The drop authority. DropAuth identifies the processes that can deregister 
  1053.     the subcommand handler. The possible DropAuth values are: 
  1054.  
  1055.     RXSUBCOM_DROPPABLE 
  1056.             Any process can deregister the subcommand handler with 
  1057.             RexxDeregisterSubcom. 
  1058.  
  1059.     RXSUBCOM_NONDROP 
  1060.             Only a thread within the same process as the thread that registered 
  1061.             the handler can deregister the handler with RexxDeregisterSubcom. 
  1062.  
  1063.  
  1064. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1065.  
  1066. RexxRegisterSubcomDll returns the following values: 
  1067.  
  1068.  0         RXSUBCOM_OK 
  1069.  10        RXSUBCOM_DUP 
  1070.  1002      RXSUBCOM_NOEMEM 
  1071.  1003      RXSUBCOM_BADTYPE 
  1072.  
  1073.  
  1074. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1075.  
  1076. EntryPoint can be either a 16-bit or a 32-bit routine. REXX will invoke the 
  1077. handler in the correct addressing mode. 
  1078.  
  1079. A REXX procedure can register dynamic link library subcommand handlers with the 
  1080. RXSUBCOM command. For example: 
  1081.  
  1082.                                  /* register Dialog Manager       */
  1083.                                  /* subcommand handler            */
  1084.   'RXSUBCOM REGISTER ISPCIR ISPCIR ISPCIR'
  1085.   Address ispcir                 /* send commands to dialog mgr   */
  1086.  
  1087. The RXSUBCOM command registers the Dialog Manager subcommand handler ISPCIR as 
  1088. routine ISPCIR in the ISPCIR dynamic link library. 
  1089.  
  1090.  
  1091. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterSubcomDll ΓòÉΓòÉΓòÉ
  1092.  
  1093. The following functions are related to RexxRegisterSubcomDll: 
  1094.  
  1095.       RexxRegisterSubcomExe 
  1096.       RexxDeregisterSubcom 
  1097.       RexxQuerySubcom 
  1098.       RexxStart 
  1099.  
  1100.  
  1101. ΓòÉΓòÉΓòÉ 8.2. RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1102.  
  1103.  
  1104. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1105.  
  1106. Topics: 
  1107.  
  1108.       Call Syntax 
  1109.       Uses 
  1110.       Parameters 
  1111.       Return Values 
  1112.       Errors 
  1113.       Notes 
  1114.       Related Functions 
  1115.       Examples 
  1116.       Sample Programs 
  1117.  
  1118.  
  1119. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1120.  
  1121. /*******************************************/
  1122. /* RexxRegisterSubcomExe registers a      */
  1123. /*  subcommand handler that resides within */
  1124. /*  application code .                     */
  1125. /*******************************************/
  1126.  
  1127. #define INCL_RXSUBCOM       /* Subcommand handler values */
  1128.  
  1129. PSZ     name;         /* handler name */
  1130. ULONG   rc;           /* Return code  */
  1131. ULONG   userdata[2];  /* save userdata*/
  1132.  
  1133. rc = RexxRegisterSubcomExe(name, &handler_routine,
  1134.      userdata);
  1135.  
  1136.  
  1137. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1138.  
  1139. RexxRegisterSubcomExe registers a subcommand handler that resides within 
  1140. application code. 
  1141.  
  1142.  
  1143. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1144.  
  1145. RexxRegisterSubcomExe (EnvName, EntryPoint, UserArea) 
  1146.  
  1147. Parameters: 
  1148.  
  1149.  EnvName (PSZ) - input 
  1150.     Address of an ASCIIZ subcommand handler name. 
  1151.  
  1152.  EntryPoint (PFN) - input 
  1153.     Address of the subcommand handler entry point within the application EXE 
  1154.     code. pt.UserArea (PUCHAR) - input pd. Address of an 8-byte area of user 
  1155.     defined information. The 8 bytes addressed by UserArea will be saved with 
  1156.     the subcommand handler registration. UserArea can be NULL if there is no 
  1157.     user information to save. The user information can be retrieved with the 
  1158.     RexxQuerySubcom function. 
  1159.  
  1160.  
  1161. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1162.  
  1163. RexxRegisterSubcomExe returns the following values: 
  1164.  
  1165.  0         RXSUBCOM_OK 
  1166.  10        RXSUBCOM_DUP 
  1167.  30        RXSUBCOM_NOTREG 
  1168.  1002      RXSUBCOM_NOEMEM 
  1169.  1003      RXSUBCOM_BADTYPE 
  1170.  
  1171.  
  1172. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1173.  
  1174. If EnvName is same as a subcommand handler already registered with 
  1175. RexxRegisterSubcomDll, RexxRegisterSubcomExe will return RXSUBCOM_DUP. This is 
  1176. not an error condition. RexxRegisterSubcomExe has successfully registered the 
  1177. new subcommand handler. 
  1178.  
  1179.  
  1180. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1181.  
  1182. The following functions are related to RexxRegisterSubcomExe: 
  1183.  
  1184.       RexxRegisterSubcomDll 
  1185.       RexxDeregisterSubcom 
  1186.       RexxQuerySubcom 
  1187.       RexxStart 
  1188.  
  1189.  
  1190. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxRegisterSubcomExe ΓòÉΓòÉΓòÉ
  1191.  
  1192. The following example shows the use of RexxRegisterSubcomExe: 
  1193.  
  1194.   WORKAREARECORD  *user_info[2];       /* saved user information     */
  1195.  
  1196.   user_info[0] = global_workarea;      /* save global work area for  */
  1197.   user_info[1] = NULL;                 /* re-entrancy                */
  1198.  
  1199.   rc = RexxRegisterSubcomExe("Editor", /* register editor handler    */
  1200.       &Edit_Commands,                  /* located at this address    */
  1201.       user_info);                      /* save global pointer        */
  1202.  
  1203.  
  1204. ΓòÉΓòÉΓòÉ 8.3. RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1205.  
  1206.  
  1207. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1208.  
  1209. Topics: 
  1210.  
  1211.       Call Syntax 
  1212.       Uses 
  1213.       Parameters 
  1214.       Return Values 
  1215.       Errors 
  1216.       Notes 
  1217.       Related Functions 
  1218.  
  1219.  
  1220. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1221.  
  1222. /*******************************************/
  1223. /* RexxDeregisterSubcom deregisters a      */
  1224. /*  subcommand handler.                    */
  1225. /*******************************************/
  1226.  
  1227. #define INCL_RXSUBCOM       /* Subcommand handler values */
  1228.  
  1229. PSZ     name;       /* handler name       */
  1230. PSZ     library     /* handler dll        */
  1231. ULONG   rc;         /* Return code */
  1232.  
  1233. rc = RexxDeregisterSubcom(name, library);
  1234.  
  1235.  
  1236. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1237.  
  1238. RexxDeregisterSubcom deregisters a subcommand handler. 
  1239.  
  1240.  
  1241. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1242.  
  1243. RexxDeregisterSubcom (EnvName, ModuleName) 
  1244.  
  1245. Parameters: 
  1246.  
  1247.  EnvName (PSZ) - input 
  1248.     Address of an ASCIIZ subcommand handler name. 
  1249.  
  1250.  ModuleName (PSZ) - input 
  1251.     Address of an ASCIIZ dynalink library name. ModuleName is the name of the 
  1252.     dynalink library containing the registered subcommand handler. When 
  1253.     ModuleName is NULL, RexxDeregisterSubcom searches the RexxRegisterSubcomExe 
  1254.     subcommand handler list for a handler within the current process. If 
  1255.     RexxDeregisterSubcom does not find a RexxRegisterSubcomExe handler, it will 
  1256.     search the RexxRegisterSubcomDll subcommand handler list. 
  1257.  
  1258.  
  1259. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1260.  
  1261. RexxDeregisterSubcom returns the following values: 
  1262.  
  1263.  0         RXSUBCOM_OK 
  1264.  30        RXSUBCOM_NOTREG 
  1265.  40        RXSUBCOM_NOCANDROP 
  1266.  1003      RXSUBCOM_BADTYPE 
  1267.  
  1268.  
  1269. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1270.  
  1271. The handler is removed from the active subcommand handler list. 
  1272.  
  1273.  
  1274. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxDeregisterSubcom ΓòÉΓòÉΓòÉ
  1275.  
  1276. The following functions are related to RexxDeregisterSubcom: 
  1277.  
  1278.       RexxRegisterSubcomDll 
  1279.       RexxRegisterSubcomExe 
  1280.       RexxQuerySubcom 
  1281.  
  1282.  
  1283. ΓòÉΓòÉΓòÉ 8.4. RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1284.  
  1285.  
  1286. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1287.  
  1288. Topics: 
  1289.  
  1290.       Call Syntax 
  1291.       Uses 
  1292.       Parameters 
  1293.       Return Values 
  1294.       Errors 
  1295.       Related Functions 
  1296.       Examples 
  1297.  
  1298.  
  1299. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1300.  
  1301. /*******************************************/
  1302. /* RexxQuerySubcom queries a subcommand   */
  1303. /*  handler and retrieves saved user       */
  1304. /*  information.                           */
  1305. /*******************************************/
  1306.  
  1307. #define INCL_RXSUBCOM       /* subcommand handler values */
  1308.  
  1309. PSZ     name;         /* handler name */
  1310. PSZ     library;      /* DLL name     */
  1311. ULONG   userdata[2];  /* saved information */
  1312. ULONG   rc;         /* Return code */
  1313.  
  1314. rc = RexxQuerySubcom(name, library, userdata);
  1315.  
  1316.  
  1317. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1318.  
  1319. RexxQuerySubcom queries a subcommand handler and retrieves saved user 
  1320. information. 
  1321.  
  1322.  
  1323. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1324.  
  1325. RexxQuerySubcom (EnvName, ModuleName, Flag, UserWord) 
  1326.  
  1327. Parameters: 
  1328.  
  1329.  EnvName (PSZ) - input 
  1330.     Address of an ASCIIZ subcommand handler name. 
  1331.  
  1332.  ModuleName (PSZ) - input 
  1333.     Address of an ASCIIZ dynamic link library name. ModuleName restricts the 
  1334.     query to a subcommand handler within the ModuleName dynamic link library. 
  1335.     When ModuleName is NULL, RexxQuerySubcom searches the RexxRegisterSubcomExe 
  1336.     subcommand handler list for a handler within the current process. If 
  1337.     RexxQuerySubcom does not find a RexxRegisterSubcomExe handler, it will 
  1338.     search the RexxRegisterSubcomDll subcommand handler list. 
  1339.  
  1340.  Flag (PUSHORT) - output 
  1341.     Subcommand handler registration flag. Flag is the EnvName subcommand 
  1342.     handler registration status. When RexxQuerySubcom returns RXSUBCOM_OK, the 
  1343.     EnvName subcommand handler is currently registered. When RexxQuerySubcom 
  1344.     returns RXSUBCOM_NOTREG, the EnvName subcommand handler is not registered. 
  1345.  
  1346.  UserWord (PUCHAR) - output 
  1347.     Address of an 8-byte area to receive the user information saved with 
  1348.     RexxRegisterSubcomExe or RexxRegisterSubcomDll. UserWord can be NULL if the 
  1349.     saved user information is not required. 
  1350.  
  1351.  
  1352. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1353.  
  1354. RexxQuerySubcom returns the following values: 
  1355.  
  1356.  0         RXSUBCOM_OK 
  1357.  30        RXSUBCOM_NOTREG 
  1358.  1003      RXSUBCOM_BADTYPE 
  1359.  
  1360.  
  1361. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1362.  
  1363. The following functions are related to RexxQuerySubcom: 
  1364.  
  1365.       RexxRegisterSubcomDll 
  1366.       RexxRegisterSubcomExe 
  1367.       RexxDeregisterSubcom 
  1368.  
  1369.  
  1370. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxQuerySubcom ΓòÉΓòÉΓòÉ
  1371.  
  1372. The following examples show the use of RexxQuerySubcom: 
  1373.  
  1374. ULONG Edit_Commands(
  1375.   PRXSTRING Command,    /* Command string passed from the caller    */
  1376.   PUSHORT   Flags,      /* pointer to short for return of flags     */
  1377.   PRXSTRING Retstr)     /* pointer to RXSTRING for RC return        */
  1378. {
  1379.   WORKAREARECORD  *user_info[2];       /* saved user information     */
  1380.   WORKAREARECORD   global_workarea;    /* application data anchor    */
  1381.   USHORT           query_flag;         /* flag for handler query     */
  1382.  
  1383.  
  1384.   rc = RexxQuerySubcom("Editor",       /* retrieve application work  */
  1385.       NULL,                            /* area anchor from REXX.     */
  1386.       &query_flag,
  1387.       user_info);
  1388.  
  1389.   global_workarea = user_info[0];      /* set the global anchor      */
  1390.  
  1391.  
  1392. ΓòÉΓòÉΓòÉ <hidden> Subcommand Interface Errors ΓòÉΓòÉΓòÉ
  1393.  
  1394. The following are the subcommand handler function errors.: 
  1395.  
  1396.  RXSUBCOM_NOEMEM 
  1397.     There is insufficient memory available to complete this request. 
  1398.  
  1399.  RXSUBCOM_OK 
  1400.     A subcommand function has executed successfully. 
  1401.  
  1402.  RXSUBCOM_DUP 
  1403.     A duplicate handler name has been successfully registered; there is either: 
  1404.  
  1405.         an EXE handler with the same name registered in another process, or 
  1406.  
  1407.         a DLL handler with the same name registered in another DLL; to address 
  1408.          this subcommand, its library name must be specified. 
  1409.  
  1410.  RXSUBCOM_NOTREG 
  1411.     This indicates: 
  1412.  
  1413.         registration was unsuccessful due to duplicate handler and dynalink 
  1414.          names (RexxRegisterSubcomExe or RexxRegisterSubcomDll) 
  1415.  
  1416.         the subcommand handler is not registered (other REXX subcommand 
  1417.          functions). 
  1418.  
  1419.  RXSUBCOM_NOCANDROP 
  1420.     The subcommand handler has been registered as "not droppable". 
  1421.  
  1422.  
  1423. ΓòÉΓòÉΓòÉ 9. External Functions ΓòÉΓòÉΓòÉ
  1424.  
  1425. There are two types of REXX external functions: 
  1426.  
  1427.    1. Routines written in REXX 
  1428.  
  1429.    2. Routines written in other OS/2* operating system supported languages. 
  1430.  External functions written in the REXX language are not registered with REXX. 
  1431.  the REXX functions are found by a disk search for a REXX procedure file that 
  1432.  matches the function name. Functions written in other languages, however, must 
  1433.  be registered with the REXX interpeter. 
  1434.  
  1435.  
  1436. ΓòÉΓòÉΓòÉ 9.1. Registering External Functions ΓòÉΓòÉΓòÉ
  1437.  
  1438. An external function can reside in the same module (EXE or DLL) as an 
  1439. application, or it can reside in a separate dynamic link library. 
  1440. RexxRegisterFunctionExe registers external functions within an application 
  1441. module. External functions registered with RexxRegisterFunctionExe 
  1442.  
  1443. The RexxRegisterFunctionDll function registers external functions that reside 
  1444. in a dynamic link library. Once registered, a dynamic link library external 
  1445. function can be accessed by any REXX program. A dynamic link library external 
  1446. function can also be registered directly from a REXX program using the REXX 
  1447. RxFuncAdd built-in function. 
  1448.  
  1449.  
  1450. ΓòÉΓòÉΓòÉ 9.2. Creating External Functions ΓòÉΓòÉΓòÉ
  1451.  
  1452. The following is a sample external function definition: 
  1453.  
  1454.  
  1455. Sample External Function Definition
  1456.  
  1457. ULONG SysLoadFuncs(
  1458.      PSZ       Name,                   /* name of the function       */
  1459.      LONG      Argc,                   /* number of arguments        */
  1460.      RXSTRING  Argv[],                 /* list of argument strings   */
  1461.      PSZ       Queuename,              /* current queue name         */
  1462.      PRXSTRING Retstr)                 /* returned result string     */
  1463.  
  1464. Where 
  1465.  
  1466.  Name        Address of ASCIIZ external function name. 
  1467.  
  1468.  Argc        The size of the argument list. Argv will contain Argc RXSTRINGs. 
  1469.  
  1470.  Argv        An array of null-terminated RXSTRINGs for the function arguments. 
  1471.  
  1472.  Queue       The name of the currently defined REXX external data queue. 
  1473.  
  1474.  Retstr      Address of an RXSTRING for the returned value. Retstr is a 
  1475.              character string function or subroutine return value. When a REXX 
  1476.              program calls an external function with the REXX CALL instruction, 
  1477.              Retstr is assigned to the REXX special variable RESULT. When the 
  1478.              REXX program calls an external function as a function, Retstr is 
  1479.              used directly within the REXX expression. 
  1480.  
  1481.              The REXX interpreter provides a default 256-byte RXSTRING in 
  1482.              Retstr. A longer RXSTRING can allocated with "DosAllocMem" if the 
  1483.              returned string is longer name 256 bytes. The REXX interpreter 
  1484.              releases Retstr with "DosFreeMem" when the external function 
  1485.              completes. 
  1486.  
  1487.  Returns     An integer return code from the function. When the external 
  1488.              function returns 0, the function completed successfully. Retstr 
  1489.              contains the function return value. When external function return 
  1490.              code is not 0, the REXX interpreter raises REXX error 40 ("Invalid 
  1491.              call to routine").  The Retstr value is ignored. 
  1492.  
  1493.              If the external function does not have a return value, the 
  1494.              function must set Retstr to an an empty RXSTRING (NULL strptr). 
  1495.              When a function does not return a value, the interpreter raises 
  1496.              error 44, "Function did not return data". When an external 
  1497.              function invoked with the REXX CALL instruction does not return a 
  1498.              value, the REXX interpreter drops (unassigns) the special variable 
  1499.              RESULT. 
  1500.  
  1501.  
  1502. ΓòÉΓòÉΓòÉ 9.3. Calling External Functions ΓòÉΓòÉΓòÉ
  1503.  
  1504. RexxRegisterFunctionExe Only REXX procedures running in the same process can 
  1505. use the registered external function. It is possible to register functions with 
  1506. the same external function name if they are registered from different 
  1507. processes. However, RexxRegisterFunctionDll functions are available from all 
  1508. processes. The function names cannot be duplicated. 
  1509.  
  1510.  
  1511. ΓòÉΓòÉΓòÉ 9.4. Sample External Function ΓòÉΓòÉΓòÉ
  1512.  
  1513. ULONG SysMkDir(
  1514.      PSZ       Name,                   /* name of the function       */
  1515.      LONG      Argc,                   /* number of arguments        */
  1516.      RXSTRING  Argv[],                 /* list of argument strings   */
  1517.      PSZ       Queuename,              /* current queue name         */
  1518.      PRXSTRING Retstr)                 /* returned result string     */
  1519. {
  1520.   ULONG  rc;                           /* Return code of function    */
  1521.  
  1522.   if (Argc != 1)                       /* must be 1 argument         */
  1523.     return 40;                         /* incorrect call if not      */
  1524.  
  1525.                                        /* make the directory using   */
  1526.                                        /* the null-terminated        */
  1527.   rc = DosMkDir(Argv[0].strptr, 0L);   /* directly                   */
  1528.  
  1529.   sprintf(Retstr->strptr, "%d", rc);   /* result is return code      */
  1530.                                        /* set proper string length   */
  1531.   Retstr->strlength = strlen(Retstr->strptr);
  1532.   return 0;                            /* successful completion      */
  1533. }
  1534.  
  1535.  
  1536. ΓòÉΓòÉΓòÉ 10. External Function Interface Functions ΓòÉΓòÉΓòÉ
  1537.  
  1538.      RexxRegisterFunctionDll registers an external function that resides in a 
  1539.       dynamic link library routine. 
  1540.  
  1541.      RexxRegisterFunctionExe registers an external function that resides 
  1542.       within application code. 
  1543.  
  1544.      RexxDeregisterFunction deregisters an external function. 
  1545.  
  1546.      RexxQueryFunction queries the existence of a registered external 
  1547.       function. 
  1548.  
  1549.  
  1550. ΓòÉΓòÉΓòÉ 10.1. RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1551.  
  1552.  
  1553. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1554.  
  1555. Topics: 
  1556.  
  1557.       Call Syntax 
  1558.       Uses 
  1559.       Parameters 
  1560.       Return Values 
  1561.       Errors 
  1562.       Notes 
  1563.       Related Functions 
  1564.       Examples 
  1565.  
  1566.  
  1567. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1568.  
  1569. /*******************************************/
  1570. /* RexxRegisterFunctionDll registers an   */
  1571. /*  external function that resides in a    */
  1572. /*  dynamic link library routine.          */
  1573. /*******************************************/
  1574.  
  1575. #define INCL_RXFUNC       /* External function values */
  1576.  
  1577. PSZ     name;         /* function name */
  1578. PSZ     library;      /* DLL name      */
  1579. PSZ     routine;      /* routine name  */
  1580. ULONG   rc;           /* Return code   */
  1581.  
  1582. rc = RexxRegisterFunctionDll(name, library, routine);
  1583.  
  1584.  
  1585. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1586.  
  1587. RexxRegisterFunctionDll registers an external function that resides in a 
  1588. dynamic link library routine. 
  1589.  
  1590.  
  1591. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1592.  
  1593. RexxRegisterFunctionDll (FuncName, ModuleName, EntryPoint) 
  1594.  
  1595. Parameters: 
  1596.  
  1597.  FuncName (PSZ) - input 
  1598.     Address of an ASCIIZ external function name. 
  1599.  
  1600.  ModuleName (PSZ) - input 
  1601.     Address of an ASCIIZ dynamic link library name. ModuleName is the DLL file 
  1602.     containing the external function routine. 
  1603.  
  1604.  EntryPoint (PSZ) - input 
  1605.     Address of an ASCIIZ dynamic link procedure name. EntryPoint is exported 
  1606.     external function routine within ModuleName. 
  1607.  
  1608.  
  1609. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1610.  
  1611. RexxRegisterFunctionDll returns the following values: 
  1612.  
  1613.  0         RXFUNC_OK 
  1614.  10        RXFUNC_DEFINED 
  1615.  20        RXFUNC_NOMEM 
  1616.  
  1617.  
  1618. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1619.  
  1620. EntryPoint can be either a 16-bit or 32-bit routine. REXX will invoke the 
  1621. function in the correct addressing mode. 
  1622.  
  1623. A REXX procedure can register dynamic link library subcommand handlers with the 
  1624. RxFuncAdd built-in function. For example: 
  1625.  
  1626.                                  /* register function SysLoadFuncs*/
  1627.                                  /* in dynalink library REXXUTIL  */
  1628.   Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  1629.   Call SysLoadFuncs              /* call to load other functions  */
  1630.  
  1631. The RxFuncAdd registers the external function SysLoadFuncs as routine 
  1632. SysLoadFuncs in the REXXUTIL dynamic link library. SysLoadFuncs registers 
  1633. additional functions in REXXUTIL.DLL with RexxRegisterFunctionDll. 
  1634.  
  1635.  
  1636. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1637.  
  1638. The following functions are related to RexxRegisterFunctionDll: 
  1639.  
  1640.       RexxRegisterFunctionExe 
  1641.       RexxDeregisterFunction 
  1642.       RexxQueryFunction 
  1643.  
  1644.  
  1645. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxRegisterFunctionDll ΓòÉΓòÉΓòÉ
  1646.  
  1647. The following example shows the use of RexxRegisterFunctionDll: 
  1648.  
  1649. static PSZ  RxFncTable[] =             /* function package list      */
  1650. {
  1651.       "SysCls",
  1652.       "SysCurpos",
  1653.       "SysCurState",
  1654.       "SysDriveInfo",
  1655. }
  1656.  
  1657.  
  1658. ULONG SysLoadFuncs(
  1659.      PSZ       Name,                   /* name of the function       */
  1660.      LONG      Argc,                   /* number of arguments        */
  1661.      RXSTRING  Argv[],                 /* list of argument strings   */
  1662.      PSZ       Queuename,              /* current queue name         */
  1663.      PRXSTRING Retstr)                 /* returned result string     */
  1664. {
  1665.   INT    entries;                      /* Num of entries             */
  1666.   INT    j;                            /* Counter                    */
  1667.  
  1668.   Retstr->strlength = 0;               /* set null string return     */
  1669.  
  1670.   if (Argc > 0)                        /* check arguments            */
  1671.     return 40;                         /* too many, raise an error   */
  1672.  
  1673.                                        /* get count of arguments     */
  1674.   entries = sizeof(RxFncTable)/sizeof(PSZ);
  1675.                                        /* register each function in  */
  1676.   for (j = 0; j < entries; j++) {      /* the table                  */
  1677.     RexxRegisterFunctionDll(RxFncTable[j],
  1678.           "REXXUTIL", RxFncTable[j]);
  1679.   }
  1680.   return 0;                            /* successful completion      */
  1681. }
  1682.  
  1683.  
  1684. ΓòÉΓòÉΓòÉ 10.2. RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1685.  
  1686.  
  1687. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1688.  
  1689. Topics: 
  1690.  
  1691.       Call Syntax 
  1692.       Uses 
  1693.       Parameters 
  1694.       Return Values 
  1695.       Errors 
  1696.       Related Functions 
  1697.  
  1698.  
  1699. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1700.  
  1701. /*******************************************/
  1702. /* RexxRegisterFunctionExe registers an   */
  1703. /*  external function that resides within  */
  1704. /*  application code.                      */
  1705. /*******************************************/
  1706.  
  1707. #define INCL_RXFUNC       /* external function values */
  1708.  
  1709. PSZ     name;         /* handler name */
  1710. ULONG   rc;           /* Return code  */
  1711.  
  1712. rc = RexxRegisterFunctionExe(name, &external_function);
  1713.  
  1714.  
  1715. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1716.  
  1717. RexxRegisterFunctionExe registers an external function that resides within 
  1718. application code. 
  1719.  
  1720.  
  1721. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1722.  
  1723. RexxRegisterFunctionExe (FuncName, EntryPoint) 
  1724.  
  1725. Parameters: 
  1726.  
  1727.  FuncName (PSZ) - input 
  1728.     Address of an ASCIIZ external function name. 
  1729.  
  1730.  EntryPoint (PFN) - input 
  1731.     Address of the external function entry point within the application EXE 
  1732.     file. Functions registered with RexxRegisterFunctionExe are local to the 
  1733.     current process. REXX procedures in the same process as the 
  1734.     RexxRegisterFunctionExe function caller can use local external functions. 
  1735.  
  1736.  
  1737. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1738.  
  1739. RexxRegisterFunctionExe returns the following values: 
  1740.  
  1741.  0         RXFUNC_OK 
  1742.  10        RXFUNC_DEFINED 
  1743.  20        RXFUNC_NOMEM 
  1744.  
  1745.  
  1746. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterFunctionExe ΓòÉΓòÉΓòÉ
  1747.  
  1748. The following functions are related to RexxRegisterFunctionExe: 
  1749.  
  1750.       RexxRegisterFunctionDll 
  1751.       RexxDeregisterFunction 
  1752.       RexxQueryFunction 
  1753.  
  1754.  
  1755. ΓòÉΓòÉΓòÉ 10.3. RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1756.  
  1757.  
  1758. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1759.  
  1760. Topics: 
  1761.  
  1762.       Call Syntax 
  1763.       Uses 
  1764.       Parameters 
  1765.       Return Values 
  1766.       Errors 
  1767.       Related Functions 
  1768.  
  1769.  
  1770. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1771.  
  1772. /*******************************************/
  1773. /* RexxDeregisterFunction deregisters an   */
  1774. /*  external function.                     */
  1775. /*******************************************/
  1776.  
  1777. #define INCL_RXFUNC       /* External Function values */
  1778.  
  1779. PSZ     name;       /* function name      */
  1780. ULONG   rc;         /* Return code        */
  1781.  
  1782. rc = RexxDeregisterFunction(name);
  1783.  
  1784.  
  1785. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1786.  
  1787. RexxDeregisterFunction deregisters an external function. 
  1788.  
  1789.  
  1790. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1791.  
  1792. RexxDeregisterFunction (FuncName) 
  1793.  
  1794. Parameters: 
  1795.  
  1796.  FuncName (PSZ) - input 
  1797.     Address of an ASCIIZ external function name to deregister. 
  1798.  
  1799.  
  1800. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1801.  
  1802. RexxDeregisterFunction returns the following values: 
  1803.  
  1804.  0         RXFUNC_OK 
  1805.  30        RXFUNC_NOTREG 
  1806.  
  1807.  
  1808. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxDeregisterFunction ΓòÉΓòÉΓòÉ
  1809.  
  1810. The following functions are related to RexxDeregisterFunction: 
  1811.  
  1812.       RexxRegisterFunctionDll 
  1813.       RexxRegisterFunctionExe 
  1814.       RexxQueryFunction 
  1815.  
  1816.  
  1817. ΓòÉΓòÉΓòÉ 10.4. RexxQueryFunction ΓòÉΓòÉΓòÉ
  1818.  
  1819.  
  1820. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  1821.  
  1822. Topics: 
  1823.  
  1824.       Call Syntax 
  1825.       Uses 
  1826.       Parameters 
  1827.       Return Values 
  1828.       Errors 
  1829.       Notes 
  1830.       Related Functions 
  1831.  
  1832.  
  1833. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1834.  
  1835. /*******************************************/
  1836. /* RexxQueryFunction queries the          */
  1837. /*  existence of a registered external     */
  1838. /*  function.                              */
  1839. /*******************************************/
  1840.  
  1841. #define INCL_RXFUNC      /* External function values */
  1842.  
  1843. PSZ     name;       /* function name */
  1844. ULONG   rc;         /* Return code */
  1845.  
  1846. rc = RexxQueryFunction(name);
  1847.  
  1848.  
  1849. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1850.  
  1851. RexxQueryFunction queries the existence of a registered external function. 
  1852.  
  1853.  
  1854. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1855.  
  1856. RexxQueryFunction (FuncName) 
  1857.  
  1858. Parameters: 
  1859.  
  1860.  FuncName (PSZ) - input 
  1861.     Address of an ASCIIZ external function name to query. 
  1862.  
  1863.  
  1864. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1865.  
  1866. RexxQueryFunction returns the following values: 
  1867.  
  1868.  0         RXFUNC_OK 
  1869.  30        RXFUNC_NOTREG 
  1870.  
  1871.  
  1872. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1873.  
  1874. RexxQueryFunction will only return RXFUNC_OK if the requested function is 
  1875. available to the current process. If a function is not available to the current 
  1876. process, RexxQueryFunction search will search the RexxRegisterFunctionDll 
  1877. external function list. 
  1878.  
  1879.  
  1880. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxQueryFunction ΓòÉΓòÉΓòÉ
  1881.  
  1882. The following functions are related to RexxQueryFunction: 
  1883.  
  1884.       RexxRegisterFunctionDll 
  1885.       RexxRegisterFunctionExe 
  1886.       RexxDeregisterFunction 
  1887.  
  1888.  
  1889. ΓòÉΓòÉΓòÉ <hidden> External Function Interface Errors ΓòÉΓòÉΓòÉ
  1890.  
  1891. The following are the external function interface errors.: 
  1892.  
  1893.  RXFUNC_OK 
  1894.     The function call completed successfully. 
  1895.  
  1896.  RXFUNC_DEFINED 
  1897.     The requested function is already registered. 
  1898.  
  1899.  RXFUNC_NOMEM 
  1900.     There is not enough memory to register a new function. 
  1901.  
  1902.  RXFUNC_NOTREG 
  1903.     The requested function is not registered. 
  1904.  
  1905.  
  1906. ΓòÉΓòÉΓòÉ 11. System Exits ΓòÉΓòÉΓòÉ
  1907.  
  1908. The REXX System Exits create user-define REXX interpreter operating 
  1909. environment. Application defined exit handlers process specified REXX 
  1910. interpreter activities. 
  1911.  
  1912. Applications can create exits for: 
  1913.  
  1914.      The administration of resources at the beginning and end of 
  1915.       interpretation. 
  1916.  
  1917.      Linkages to external functions and subcommand handlers. 
  1918.  
  1919.      Special language features. For example, input and output to standard 
  1920.       resources. 
  1921.  
  1922.      Polling for halt and external trace events. 
  1923.  
  1924.  Exit handlers are similar to subcommand handlers and external functions: 
  1925.  
  1926.      Applications must registers named exit handlers with the REXX 
  1927.       interpreter. 
  1928.  
  1929.      Exit handlers can reside in dynamic link libraries or within an 
  1930.       application EXE module. 
  1931.  
  1932.  
  1933. ΓòÉΓòÉΓòÉ 11.1. Writing System Exit Handlers ΓòÉΓòÉΓòÉ
  1934.  
  1935. The following is a sample exit handler definition: 
  1936.  
  1937.  
  1938. Sample System Exit Handler Definition
  1939.  
  1940. LONG Rexx_IO_exit(
  1941.      LONG  ExitNumber,    /* code defining the exit function    */
  1942.      LONG  Subfunction,   /* code defining the exit subfunction */
  1943.      PEXIT ParmBlock)     /* function dependent control block   */
  1944.  
  1945. Where: 
  1946.  
  1947.  ExitNumber  The major function code defining the type of exit. 
  1948.  
  1949.  Subfunction The subfunction code defining the exit event. 
  1950.  
  1951.  ParmBlock   A pointer to the exit parameter list. 
  1952.  
  1953.              The exit parameter list contains exit specific information. See 
  1954.              the exit descriptions below parameter list formats. 
  1955.  
  1956.              Note:  Some exit subfunctions do not have parameters. ParmBlock 
  1957.                     for exit subfunctions without parameters. 
  1958.  
  1959.  
  1960. ΓòÉΓòÉΓòÉ 11.1.1. Exit Return Codes ΓòÉΓòÉΓòÉ
  1961.  
  1962. Exit handlers return an integer value that signals one of three actions: 
  1963.  
  1964.  RXEXIT_HANDLED 
  1965.     The exit handler processed the exit subfunction and updated the subfunction 
  1966.     parameter list as required. The REXX interpreter continues with normal 
  1967.     processing. 
  1968.  
  1969.  RXEXIT_NOT_HANDLED 
  1970.     The exit handler did not process the exit subfunction. The REXX interpreter 
  1971.     processes the subfunction as if the exit handler was not called. 
  1972.  
  1973.  RXEXIT_RAISE_ERROR 
  1974.     A fatal error occurred in the exit handler. The REXX interpreter raises 
  1975.     REXX error 48 ("Failure in system service"). 
  1976.  
  1977.  For example, if an application creates an input/output exit handler: 
  1978.  
  1979.      When the exit handler returns RXEXIT_NOT_HANDLED for an RXSIOSAY 
  1980.       subfunction, the REXX interpreter writes the output line to STDOUT. 
  1981.  
  1982.      When the exit handler returns RXEXIT_HANDLED for an RXSIOSAY subfunction, 
  1983.       the REXX interpreter assumes the exit handler has performed all required 
  1984.       output. The interpreter will not write the output line to STDOUT. 
  1985.  
  1986.      When the exit handler returns RXEXIT_RAISE_ERROR for an RXSIOSAY 
  1987.       subfunction, the interpreter raise REXX error 48, "Failure in system 
  1988.       service". 
  1989.  
  1990.  
  1991. ΓòÉΓòÉΓòÉ 11.1.2. Exit Parameters ΓòÉΓòÉΓòÉ
  1992.  
  1993. Each exit subfunction has a different parameter list. All RXSTRING exit 
  1994. subfunction parameters are passed as null-terminated RXSTRINGs. It is possible 
  1995. that the RXSTRING value will contain null characters also. 
  1996.  
  1997. For some exit subfunctions, the exit handler can return an RXSTRING character 
  1998. result in the parameter list. The interpreter provides a default 256-byte for 
  1999. RXSTRING result strings. If the result is longer than 256 bytes, a new RXSTRING 
  2000. can be allocated using "DosAllocMem". The REXX interpreter will return the 
  2001. RXSTRING storage for the exit handler. 
  2002.  
  2003.  
  2004. ΓòÉΓòÉΓòÉ 11.1.3. Identifying Exit Handlers to REXX ΓòÉΓòÉΓòÉ
  2005.  
  2006. System exit handlers must be registered with RexxRegisterExitDll or 
  2007. RexxRegisterExitExe The system exit handler registration is similar to 
  2008. subcommand handler registration. 
  2009.  
  2010. The REXX system exits are enabled with the RexxStart function parameter Exits. 
  2011. Exits is a pointer to an array of RXSYSEXIT structures. Each RXSYSEXIT 
  2012. structure in the array contains a REXX exit code and the address of an ASCIIZ 
  2013. exit handler name. The RXENDLST exit code marks the exit list end. 
  2014.  
  2015. The REXX interpreter calls the registered exit handler in sysexit_name for all 
  2016. sysexit_code subfunctions. 
  2017. Example 
  2018.  
  2019.  
  2020. Sample System Exit Usage
  2021.  
  2022. WORKAREARECORD  *user_info[2];         /* saved user information     */
  2023. RXSYSEXIT exit_list[2];                /* system exit list           */
  2024.  
  2025.   user_info[0] = global_workarea;      /* save global work area for  */
  2026.   user_info[1] = NULL;                 /* re-entrancy                */
  2027.  
  2028.   rc = RexxRegisterExitExe("EditInit", /* register exit handler      */
  2029.       &Init_exit,                      /* located at this address    */
  2030.       user_info);                      /* save global pointer        */
  2031.  
  2032.                                        /* set up for RXINI exit      */
  2033.   exit_list[0].sysexit_name = "EditInit";
  2034.   exit_list[0].sysexit_code = RXINI;
  2035.   exit_list[1].sysexit_code = RXENDLST;
  2036.  
  2037.   return_code = RexxStart(1,           /* one argument               */
  2038.                           argv,        /* argument array             */
  2039.                           "CHANGE.ED", /* REXX procedure name        */
  2040.                           NULL,        /* use disk version           */
  2041.                           "Editor",    /* default address name       */
  2042.                           RXCOMMAND,   /* calling as a subcommand    */
  2043.                           exit_list,   /* no exits used              */
  2044.                           &rc,         /* converted return code      */
  2045.                           &retstr);    /* returned result            */
  2046.  
  2047.                                        /* process return value       */
  2048.            .
  2049.            .
  2050.            .
  2051. }
  2052.  
  2053. LONG Init_exit(
  2054.      LONG  ExitNumber,    /* code defining the exit function    */
  2055.      LONG  Subfunction,   /* code defining the exit subfunction */
  2056.      PEXIT ParmBlock)     /* function dependent control block   */
  2057. {
  2058.   WORKAREARECORD  *user_info[2];       /* saved user information     */
  2059.   WORKAREARECORD   global_workarea;    /* application data anchor    */
  2060.   USHORT           query_flag;         /* flag for handler query     */
  2061.  
  2062.  
  2063.   rc = RexxQueryExit("EditInit",       /* retrieve application work  */
  2064.       NULL,                            /* area anchor from REXX.     */
  2065.       &query_flag,
  2066.       user_info);
  2067.  
  2068.   global_workarea = user_info[0];      /* set the global anchor      */
  2069.  
  2070.   if (global_workarea->rexx_trace)     /* trace at start?            */
  2071.                                        /* turn on macro tracing      */
  2072.     RexxSetTrace(global_workarea->rexx_pid, global_workarea->rexx_tid);
  2073.   return RXEXIT_HANDLED;               /* successfully handled       */
  2074. }
  2075.  
  2076.  
  2077. ΓòÉΓòÉΓòÉ 11.2. System Exit Definitions ΓòÉΓòÉΓòÉ
  2078.  
  2079. The REXX interpreter supports the following system exits: 
  2080.  
  2081.  RXFNC     External function call exit 
  2082.  
  2083.            RXFNCCAL         Call an external function 
  2084.  
  2085.  RXCMD     Subcommand call exit 
  2086.  
  2087.            RXCMDHST         Call a subcommand handler 
  2088.  
  2089.  RXMSQ     External data queue exit 
  2090.  
  2091.            RXMSQPLL         Pull a line from the external data queue. 
  2092.            RXMSQPSH         Place a line on the external data queue. 
  2093.            RXMSQSIZ         Return number of lines on the external data queue. 
  2094.            RXMSQNAM         Set active external data queue name. 
  2095.  
  2096.  RXSIO     Standard input and output exit. 
  2097.  
  2098.            RXSIOSAY         Write a line to the standard output stream for the 
  2099.                             SAY instruction. 
  2100.            RXSIOTRC         Write a line to the standard error stream for REXX 
  2101.                             trace or REXX error messages. 
  2102.            RXSIOTRD         Read a line from the standard input stream for PULL 
  2103.                             or PARSE PULL. 
  2104.            RXSIODTR         Read a line from the standard input stream for 
  2105.                             interactive debug. 
  2106.  
  2107.  RXHLT     Halt processing exit 
  2108.  
  2109.            RXHLTTST         Test for a HALT condition. 
  2110.            RXHLTCLR         Clear a HALT condition. 
  2111.  
  2112.  RXTRC     External trace exit 
  2113.  
  2114.            RXTRCTST         Test for an external trace event. 
  2115.  
  2116.  RXINI     Initialization exit 
  2117.  
  2118.            RXINIEXT         Allow additional REXX procedure initialization. 
  2119.  
  2120.  RXTER     Termination exit 
  2121.  
  2122.            RXTEREXT         Process REXX procedure termination. 
  2123.  
  2124.  Each exit subfunction has the following characteristics: 
  2125.  
  2126.      When REXX calls the exit handler. 
  2127.  
  2128.      The default action when the exit is not provided or the exit handler does 
  2129.       not process the subfunction. 
  2130.  
  2131.      The subfunction parameter list. 
  2132.  
  2133.      The service the subfunction provides. 
  2134.  
  2135.      The state of the variable pool interface during the exit handler call. 
  2136.       The variable pool interface is fully enabled for the RXCMD, RXFNC, RXINT, 
  2137.       and RXTER exit handler calls. The variable pool interface is enabled for 
  2138.       RXSHV_EXIT requests for RXHLT, RXCMD, RXFNC, RXSIO, and RXMSQ exit 
  2139.       handler calls. 
  2140.  
  2141.  
  2142. ΓòÉΓòÉΓòÉ 11.3. RXFNC ΓòÉΓòÉΓòÉ
  2143.  
  2144. Process external function calls. 
  2145.  
  2146. The RXFNC exit has the following subfunction: 
  2147.  
  2148.  RXFNCCAL    Process external function calls. 
  2149.  
  2150.  
  2151. ΓòÉΓòÉΓòÉ 11.3.1. RXFNCCAL ΓòÉΓòÉΓòÉ
  2152.  
  2153.  
  2154. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXFNCCAL ΓòÉΓòÉΓòÉ
  2155.  
  2156. Process external function calls. 
  2157.  
  2158.       When called: When a REXX program calls an external subroutine or 
  2159.       function. 
  2160.  
  2161.       Default action: Call the external routine using the normal external 
  2162.       function search order. 
  2163.  
  2164.       Exit Action: Call the external routine, if possible. 
  2165.  
  2166.       Continuation: If necessary, raise REXX error 40 ("Invalid call to 
  2167.       routine"), 43 ("Routine not found"), or 44 ("Function did not return 
  2168.       data"). 
  2169.  
  2170.  Note:  The variable pool interface is fully enabled during RXFNC exit handler 
  2171.         calls. 
  2172.  
  2173.  
  2174. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXFNCCAL ΓòÉΓòÉΓòÉ
  2175.  
  2176. typedef struct {
  2177.    struct {
  2178.       unsigned rxfferr  : 1;           /* Invalid call to routine.    */
  2179.       unsigned rxffnfnd : 1;           /* Function not found.         */
  2180.       unsigned rxffsub  : 1;           /* Called as a subroutine if   */
  2181.                                        /* TRUE.  Return values are    */
  2182.                                        /* optional for subroutines,   */
  2183.                                        /* required for functions.     */
  2184.    } rxfnc_flags ;
  2185.  
  2186.    PUCHAR            rxfnc_name;       /* Pointer to function name.   */
  2187.    USHORT            rxfnc_namel;      /* Length of function name.    */
  2188.    PUCHAR            rxfnc_que;        /* Current queue name.         */
  2189.    USHORT            rxfnc_quel;       /* Length of queue name.       */
  2190.    USHORT            rxfnc_argc;       /* Number of args in list.     */
  2191.    PRXSTRING         rxfnc_argv;       /* Pointer to argument list.   */
  2192.                                        /* List mimics argv list for   */
  2193.                                        /* function calls, an array of */
  2194.                                        /* RXSTRINGs.                  */
  2195.    RXSTRING          rxfnc_retc;       /* Return value.               */
  2196. } RXFNCCAL_PARM;
  2197.  
  2198. The name of the external function is defined by rxfnc_name and rxfnc_namel. The 
  2199. arguments to the function are in rxfnc_argc and rxfnc_argv. If the named 
  2200. external function is invoked by the REXX CALL instruction (rather than as a 
  2201. function call), the flag rxffsub is TRUE. 
  2202.  
  2203. The exit handler can set rxfnc_flags to indicate the external function success. 
  2204. If neither rxfferr or rxffnfnd is TRUE, the exit hander successfully called the 
  2205. external function. The error flags are checked only when the exit handler 
  2206. handles the the request. 
  2207.  
  2208. The exit handler sets rxffnfnd to TRUE when the exit handler could not locate 
  2209. the external function. The interpreter raises REXX error 43, "Routine not 
  2210. found". The exit handler sets rxfferr to TRUE when the exit handler located the 
  2211. external function, but the external function returned an error return code. The 
  2212. REXX interpreter raises error 40, "Invalid call to routine". 
  2213.  
  2214. The exit handler returns the external function result in the rxfnc_retc 
  2215. RXSTRING. The REXX interpreter will raise error 44, "Function did not return 
  2216. data" when the external routine is invoked as a function and the exit handler 
  2217. does not return a result. When the external routine is invoked by the REXX CALL 
  2218. instruction, the exit handler a result is not required. 
  2219.  
  2220.  
  2221. ΓòÉΓòÉΓòÉ 11.4. RXCMD ΓòÉΓòÉΓòÉ
  2222.  
  2223. Process subcommand handler calls. 
  2224.  
  2225. The RXCMD exit has the following subfunction: 
  2226.  
  2227.  RXCMDHST    Call a named subcommand handler. 
  2228.  
  2229.  
  2230. ΓòÉΓòÉΓòÉ 11.4.1. RXCMDHST ΓòÉΓòÉΓòÉ
  2231.  
  2232.  
  2233. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXCMDHST ΓòÉΓòÉΓòÉ
  2234.  
  2235. Call a named subcommand handler. 
  2236.  
  2237.       When called: When a REXX procedure issues a command. 
  2238.  
  2239.       Default action: Call the named subcommand handler specified by the 
  2240.       current REXX ADDRESS setting. 
  2241.  
  2242.       Exit Action: Process the call to a named subcommand handler. 
  2243.  
  2244.       Continuation: Raise the ERROR or FAILURE condition when indicated by the 
  2245.       parameter list flags, 
  2246.  
  2247.  Note:  The variable pool interface function is fully enabled during RXCMD exit 
  2248.         handler calls. 
  2249.  
  2250.  
  2251. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXCMDHST ΓòÉΓòÉΓòÉ
  2252.  
  2253. typedef struct {
  2254.    struct {                            /* Condition flags             */
  2255.       unsigned rxfcfail : 1;           /* Command failed.  Trap with  */
  2256.                                        /* CALL or SIGNAL on FAILURE.  */
  2257.       unsigned rxfcerr  : 1;           /* Command ERROR occurred.     */
  2258.                                        /* Trap with CALL or SIGNAL on */
  2259.                                        /* ERROR.                      */
  2260.    } rxcmd_flags;
  2261.    PUCHAR            rxcmd_address;    /* Pointer to address name.    */
  2262.    USHORT            rxcmd_addressl;   /* Length of address name.     */
  2263.    PUCHAR            rxcmd_dll;        /* dll name for command.       */
  2264.    USHORT            rxcmd_dll_len;    /* Length of dll name.  0 ==>  */
  2265.                                        /* .EXE file.                  */
  2266.    RXSTRING          rxcmd_command;    /* The command string.         */
  2267.    RXSTRING          rxcmd_retc;       /* Pointer to return code      */
  2268.                                        /* buffer.  User allocated.    */
  2269. } RXCMDHST_PARM;
  2270.  
  2271. The rxcmd_command field contains the issued command. rxcmd_address, 
  2272. rxcmd_addressl, rxcmd_dll, and rxcmd_dll_len fully define the current ADDRESS 
  2273. setting. rxcmd_retc is an RXSTRING for the return code value assigned to REXX 
  2274. special variable RC. 
  2275.  
  2276. The exit handler can set rxfcfail or rxfcerr to TRUE to raise an ERROR or 
  2277. FAILURE condition. 
  2278.  
  2279.  
  2280. ΓòÉΓòÉΓòÉ 11.5. RXMSQ ΓòÉΓòÉΓòÉ
  2281.  
  2282. External data queue exit. 
  2283.  
  2284. The RXMSQ exit has the following subfunctions: 
  2285.  
  2286.  RXMSQPLL    Pull a line from the external data queue. 
  2287.  RXMSQPSH    Place a line on the external data queue. 
  2288.  RXMSQSIZ    Return the number of lines in the external data queue. 
  2289.  RXMSQNAM    Set the name of the active external data queue. 
  2290.  
  2291.  
  2292. ΓòÉΓòÉΓòÉ 11.5.1. RXMSQPLL ΓòÉΓòÉΓòÉ
  2293.  
  2294.  
  2295. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXMSQPLL ΓòÉΓòÉΓòÉ
  2296.  
  2297. Pull a line from the external data queue. 
  2298.  
  2299.       When called: When a REXX PULL instruction, PARSE PULL instruction, or 
  2300.       LINEIN() built-in function reads a line from the external data queue. 
  2301.  
  2302.       Default action: Remove a line from the current REXX data queue. 
  2303.  
  2304.       Exit Action: Return a line from the exit handler provided data queue. 
  2305.  
  2306.  
  2307. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXMSQPLL ΓòÉΓòÉΓòÉ
  2308.  
  2309. typedef struct {
  2310.    RXSTRING          rxmsq_retc;       /* Pointer to dequeued entry   */
  2311.                                        /* buffer.  User allocated.    */
  2312. } RXMSQPLL_PARM;
  2313.  
  2314. The exit handler returns the queue line in the rxmsq_retc RXSTRING. 
  2315.  
  2316.  
  2317. ΓòÉΓòÉΓòÉ 11.5.2. RXMSQPSH ΓòÉΓòÉΓòÉ
  2318.  
  2319.  
  2320. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXMSQPSH ΓòÉΓòÉΓòÉ
  2321.  
  2322. Place a line on the external data queue. 
  2323.  
  2324.       When called: Called by the REXX PUSH instruction, QUEUE instruction, or 
  2325.       LINEOUT() built-in function to add a line to the data queue. 
  2326.  
  2327.       Default action: Add the line to the current REXX data queue. 
  2328.  
  2329.       Exit Action: Add the line to the exit handler provided data queue. 
  2330.  
  2331.  
  2332. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXMSQPSH ΓòÉΓòÉΓòÉ
  2333.  
  2334. typedef struct {
  2335.    struct {                            /* Operation flag              */
  2336.       unsigned rxfmlifo : 1;           /* Stack entry LIFO when TRUE, */
  2337.                                        /* FIFO when FALSE.            */
  2338.    } rxmsq_flags;
  2339.    RXSTRING          rxmsq_value;      /* The entry to be pushed.     */
  2340. } RXMSQPSH_PARM;
  2341.  
  2342. The rxmsq_value RXSTRING contains the line added to the queue. It is the 
  2343. responsibility of the exit handler to truncate the string if the exit handler 
  2344. data queue has a maximum length restriction. rxfmlifo is the stacking order 
  2345. (LIFO or FIFO). 
  2346.  
  2347.  
  2348. ΓòÉΓòÉΓòÉ 11.5.3. RXMSQSIZ ΓòÉΓòÉΓòÉ
  2349.  
  2350.  
  2351. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXMSQSIZ ΓòÉΓòÉΓòÉ
  2352.  
  2353. Return the number of lines in the external data queue. 
  2354.  
  2355.       When called: When the REXX QUEUED() built-in function requests the size 
  2356.       of the external data queue. 
  2357.  
  2358.       Default action: Request the size from the current REXX data queue. 
  2359.  
  2360.       Exit Action: Return the size of the exit handler provided data queue. 
  2361.  
  2362.  
  2363. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXMSQSIZ ΓòÉΓòÉΓòÉ
  2364.  
  2365. typedef struct {
  2366.    ULONG             rxmsq_size;       /* Number of Lines in Queue    */
  2367. } RXMSQSIZ_PARM;
  2368.  
  2369. The exit handler returns the number of queue lines in rxmsq_size. 
  2370.  
  2371.  
  2372. ΓòÉΓòÉΓòÉ 11.5.4. RXMSQNAM ΓòÉΓòÉΓòÉ
  2373.  
  2374.  
  2375. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXMSQNAM ΓòÉΓòÉΓòÉ
  2376.  
  2377. Set the name of the active external data queue. 
  2378.  
  2379.       When called: Called by the RXQUEUE("Set",newname) built-in function. 
  2380.  
  2381.       Default action: Change the current default queue to newname. 
  2382.  
  2383.       Exit Action: Change the default queue name for the exit handler provided 
  2384.       data queue. 
  2385.  
  2386.  
  2387. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXMSQNAM ΓòÉΓòÉΓòÉ
  2388.  
  2389. typedef struct {
  2390.    RXSTRING          rxmsq_name;       /* RXSTRING containing         */
  2391.                                        /* queue name.                 */
  2392. } RXMSQNAM_PARM;
  2393.  
  2394. rxmsq_name contains the new queue name. 
  2395.  
  2396.  
  2397. ΓòÉΓòÉΓòÉ 11.6. RXSIO ΓòÉΓòÉΓòÉ
  2398.  
  2399. Standard input and output. 
  2400.  
  2401. The RXMSQ exit has the following subfunctions: 
  2402.  
  2403.  RXSIOSAY    Write a line to the standard output stream (STDOUT). 
  2404.  RXSIOTRC    Write trace and error message output to the standard error stream. 
  2405.  RXSIOTRD    Read from standard input stream. 
  2406.  RXSIODTR    Interactive debug input. 
  2407.  
  2408.  Note:  The PARSE LINEIN instruction and the LINEIN, LINEOUT, LINES, CHARIN, 
  2409.         CHAROUT, and CHARS built-in functions do not call the RXSIO exit 
  2410.         handler. 
  2411.  
  2412.  
  2413. ΓòÉΓòÉΓòÉ 11.6.1. RXSIOSAY ΓòÉΓòÉΓòÉ
  2414.  
  2415.  
  2416. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXSIOSAY ΓòÉΓòÉΓòÉ
  2417.  
  2418. Write a line to the standard output stream (STDOUT). 
  2419.  
  2420.       When called: By the SAY instruction to write a line to the standard 
  2421.       output stream. 
  2422.  
  2423.       Default action: Write to the standard output stream. 
  2424.  
  2425.       Exit Action: Write the line to the exit handler provided output stream. 
  2426.  
  2427.  
  2428. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXSIOSAY ΓòÉΓòÉΓòÉ
  2429.  
  2430. typedef struct {
  2431.    RXSTRING          rxsio_string;     /* String to display.          */
  2432. } RXSIOSAY_PARM;
  2433.  
  2434. The output line is contained in rxsio_string. The output line can be any 
  2435. length. It is the responsibility of the exit handler to truncate or split the 
  2436. line if necessary. 
  2437.  
  2438.  
  2439. ΓòÉΓòÉΓòÉ 11.6.2. RXSIOTRC ΓòÉΓòÉΓòÉ
  2440.  
  2441.  
  2442. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXSIOTRC ΓòÉΓòÉΓòÉ
  2443.  
  2444. Write trace and error message output to the standard error stream. 
  2445.  
  2446.       When called: To output lines of trace output and REXX error messages. 
  2447.  
  2448.       Default action: Write the line to the standard error stream (STDERR). 
  2449.  
  2450.       Exit Action: Write tine to the exit handler provided error output stream. 
  2451.  
  2452.  
  2453. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXSIOTRC ΓòÉΓòÉΓòÉ
  2454.  
  2455. typedef struct {
  2456.   RXSTRING           rxsio_string;     /* Trace line to display.      */
  2457. } RXSIOTRC_PARM;
  2458.  
  2459. The output line is contained in rxsio_string. The output line can be of any 
  2460. length. It is the responsibility of the exit handler to truncate or split the 
  2461. line if necessary. 
  2462.  
  2463.  
  2464. ΓòÉΓòÉΓòÉ 11.6.3. RXSIOTRD ΓòÉΓòÉΓòÉ
  2465.  
  2466.  
  2467. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXSIOTRD ΓòÉΓòÉΓòÉ
  2468.  
  2469. Read from standard input stream. 
  2470.  
  2471.       When called: To read from the standard input stream for the REXX PULL and 
  2472.       PARSE PULL instructions. 
  2473.  
  2474.       Default action: Read a line from the standard input stream (STDIN). 
  2475.  
  2476.       Exit Action: Return a line from the exit handler provided standard input 
  2477.       stream. 
  2478.  
  2479.  
  2480. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXSIOTRD ΓòÉΓòÉΓòÉ
  2481.  
  2482. typedef struct {
  2483.    RXSTRING          rxsiotrd_retc;    /* RXSTRING for output.        */
  2484. } RXSIOTRD_PARM;
  2485.  
  2486. The input stream line is returned in the rxsiotrd_retc RXSTRING. 
  2487.  
  2488.  
  2489. ΓòÉΓòÉΓòÉ 11.6.4. RXSIODTR ΓòÉΓòÉΓòÉ
  2490.  
  2491.  
  2492. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXSIODTR ΓòÉΓòÉΓòÉ
  2493.  
  2494. Interactive debug input. 
  2495.  
  2496.       When called: To read from the debug input stream for interactive debug 
  2497.       prompts. 
  2498.  
  2499.       Default action: Read a line from the standard input stream (STDIN). 
  2500.  
  2501.       Exit Action: Return a line from the exit handler provided standard debug 
  2502.       stream. 
  2503.  
  2504.  
  2505. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXSIODTR ΓòÉΓòÉΓòÉ
  2506.  
  2507. typedef struct {
  2508.    RXSTRING          rxsiodtr_retc;    /* RXSTRING for output.        */
  2509. } RXSIODTR_PARM;
  2510.  
  2511. The input stream line is returned in the rxsiodtr_retc RXSTRING. 
  2512.  
  2513.  
  2514. ΓòÉΓòÉΓòÉ 11.7. RXHLT ΓòÉΓòÉΓòÉ
  2515.  
  2516. HALT condition processing. 
  2517.  
  2518. The RXHLT exit has the following subfunctions: 
  2519.  
  2520.  RXHLTTST    Test HALT indicator. 
  2521.  RXHLTCLR    Clear HALT condition. 
  2522.  
  2523.  Note:  Since the RXHLT exit handler is called after every REXX instruction, 
  2524.         this exit will slow REXX program execution. The RexxSetHalt function 
  2525.         can halt a REXX program without between-instruction polling. 
  2526.  
  2527.  
  2528. ΓòÉΓòÉΓòÉ 11.7.1. RXHLTTST ΓòÉΓòÉΓòÉ
  2529.  
  2530.  
  2531. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXHLTTST ΓòÉΓòÉΓòÉ
  2532.  
  2533. Test HALT indicator. 
  2534.  
  2535.       When called: When the interpreter polls externally raised HALT 
  2536.       conditions. The exit is called after completion of every REXX 
  2537.       instruction. 
  2538.  
  2539.       Default action: The interpreter uses the system facilities for trapping 
  2540.       Cntrl-Break signals. 
  2541.  
  2542.       Exit Action: Return the current state of the HALT condition (either TRUE 
  2543.       or FALSE). 
  2544.  
  2545.       Continuation: Raise the REXX HALT condition if the exit handler returns 
  2546.       TRUE. 
  2547.  
  2548.  
  2549. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXHLTTST ΓòÉΓòÉΓòÉ
  2550.  
  2551. typedef struct {
  2552.    struct {                            /* Halt flag                   */
  2553.       unsigned rxfhhalt : 1;           /* Set if HALT occurred.       */
  2554.    } rxhlt_flags;
  2555. } RXHLTTST_PARM;
  2556.  
  2557. If the exit handler sets rxfhhalt to TRUE, the HALT condition will be raised in 
  2558. the REXX program. 
  2559.  
  2560. When the exit handler has set rxfhhalt to TRUE, it can also use the RXSHV_EXIT 
  2561. operation of RexxVariablePool to return a string describing the HALT condition 
  2562. reason. The REXX program can retrieve the reason string using the 
  2563. CONDITION("D") built-in function. 
  2564.  
  2565.  
  2566. ΓòÉΓòÉΓòÉ 11.7.2. RXHLTCLR ΓòÉΓòÉΓòÉ
  2567.  
  2568.  
  2569. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXHLTCLR ΓòÉΓòÉΓòÉ
  2570.  
  2571. Clear HALT condition. 
  2572.  
  2573.       When called: To acknowledge processing of the HALT condition when the 
  2574.       interpreter has recognized and raised a HALT condition 
  2575.  
  2576.       Default action: The interpreter resets the Cntrl-Break signal handlers. 
  2577.  
  2578.       Exit Action: Reset exit handler HALT state to FALSE. 
  2579.  
  2580.  
  2581. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXHLTCLR ΓòÉΓòÉΓòÉ
  2582.  
  2583. (None) 
  2584.  
  2585.  
  2586. ΓòÉΓòÉΓòÉ 11.8. RXTRC ΓòÉΓòÉΓòÉ
  2587.  
  2588. Test external trace indicator. 
  2589.  
  2590. The RXTRC exit has the following subfunction: 
  2591.  
  2592.  RXTRCTST    Test external trace indicator. 
  2593.  
  2594.  Note:  Since the RXTST exit is called after every REXX instruction, these 
  2595.         exits will slow REXX procedure execution. The RexxSetTrace function can 
  2596.         turn on REXX tracing without between-instruction polling. 
  2597.  
  2598.  
  2599. ΓòÉΓòÉΓòÉ 11.8.1. RXTRCTST ΓòÉΓòÉΓòÉ
  2600.  
  2601.  
  2602. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXTRCTST ΓòÉΓòÉΓòÉ
  2603.  
  2604. Test external trace indicator. 
  2605.  
  2606.       When called: When the interpreter polls poll for an external trace event. 
  2607.       The exit is called after completion of every REXX instruction. 
  2608.  
  2609.       Default action: None. 
  2610.  
  2611.       Exit Action: Return the current state of external tracing (either TRUE or 
  2612.       FALSE). 
  2613.  
  2614.       Continuation: When the exit handler switches from FALSE to TRUE, the REXX 
  2615.       interpreter enters REXX interactive debug mode using TRACE ?R level of 
  2616.       tracing. When the exit handler switches from TRUE to FALSE, the REXX 
  2617.       interpreter will exit interactived debug mode. 
  2618.  
  2619.  
  2620. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXTRCTST ΓòÉΓòÉΓòÉ
  2621.  
  2622. struct rxtrc_parm {
  2623.   struct {
  2624.     unsigned rxftrace : 1;        /* External trace setting        */
  2625.   } rxtrc_flags;
  2626. }
  2627.  
  2628. If the exit handler switches rxftrace to TRUE, REXX will switch on interactive 
  2629. debug mode. It the exit handler switches rxftrace to FALSE, REXX will switch 
  2630. off interactive debug mode. 
  2631.  
  2632.  
  2633. ΓòÉΓòÉΓòÉ 11.9. RXINI ΓòÉΓòÉΓòÉ
  2634.  
  2635. Initialization processing. 
  2636.  
  2637. The RXINT exit has the following subfunction: 
  2638.  
  2639.  RXINIEXT    Initialization exit. 
  2640.  
  2641.  
  2642. ΓòÉΓòÉΓòÉ 11.9.1. RXINIEXT ΓòÉΓòÉΓòÉ
  2643.  
  2644.  
  2645. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXINIEXT ΓòÉΓòÉΓòÉ
  2646.  
  2647. Initialization exit. 
  2648.  
  2649. The RXINI exit is called as the last step of REXX program initialization. The 
  2650. exit handler can perform additional initialization. For example: 
  2651.  
  2652.      Use RexxVariablePool to initialize application specific variables 
  2653.  
  2654.      Use RexxSetTrace to switch on REXX interactive debug mode. 
  2655.  
  2656.       When called: Before the first instruction of the REXX procedure is 
  2657.       interpreted. 
  2658.  
  2659.       Default action: None. 
  2660.  
  2661.       Exit Action: The exit handler can perform additional initialization. For 
  2662.       example: 
  2663.  
  2664.           Use RexxVariablePool to initialize application specific variables 
  2665.  
  2666.           Use RexxSetTrace to switch on REXX interactive debug mode. 
  2667.  
  2668.       Note:  The variable pool interface is fully enabled for this exit. 
  2669.  
  2670.  
  2671. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXINIEXT ΓòÉΓòÉΓòÉ
  2672.  
  2673. (None) 
  2674.  
  2675.  
  2676. ΓòÉΓòÉΓòÉ 11.10. RXTER ΓòÉΓòÉΓòÉ
  2677.  
  2678. Termination processing. 
  2679.  
  2680. The RXTER exit has the following subfunction: 
  2681.  
  2682.  RXTEREXT    Termination exit 
  2683.  
  2684.  
  2685. ΓòÉΓòÉΓòÉ 11.10.1. RXTEREXT ΓòÉΓòÉΓòÉ
  2686.  
  2687.  
  2688. ΓòÉΓòÉΓòÉ <hidden> Characteristics - RXTEREXT ΓòÉΓòÉΓòÉ
  2689.  
  2690. Termination exit 
  2691.  
  2692. the RXTER exit is called as the first step of REXX program termination. 
  2693.  
  2694.       When called: After the last instruction of the REXX procedure has been 
  2695.       interpreted. 
  2696.  
  2697.       Default action: None. 
  2698.  
  2699.       Exit Action: The exit handler can perform additional termination 
  2700.       activities For example, the exit handler can use RexxVariablePool to 
  2701.       retrieve REXX variables values. 
  2702.  
  2703.       Note:  The variable pool interface is fully enabled for this exit. 
  2704.  
  2705.  
  2706. ΓòÉΓòÉΓòÉ <hidden> Parameters - RXTEREXT ΓòÉΓòÉΓòÉ
  2707.  
  2708. (None) 
  2709.  
  2710.  
  2711. ΓòÉΓòÉΓòÉ 12. System Exit Functions ΓòÉΓòÉΓòÉ
  2712.  
  2713.      RexxRegisterExitDll registers an exit handler that resides in a dynalink 
  2714.       library routine. 
  2715.  
  2716.      RexxRegisterExitExe registers an exit handler that resides within 
  2717.       application code. 
  2718.  
  2719.      RexxDeregisterExit deregisters an exit handler. 
  2720.  
  2721.      RexxQueryExit queries an exit handler and retrieves saved user 
  2722.       information. 
  2723.  
  2724.  
  2725. ΓòÉΓòÉΓòÉ 12.1. RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2726.  
  2727.  
  2728. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  2729.  
  2730. Topics: 
  2731.  
  2732.       Call Syntax 
  2733.       Uses 
  2734.       Parameters 
  2735.       Return Values 
  2736.       Errors 
  2737.       Notes 
  2738.       Related Functions 
  2739.  
  2740.  
  2741. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2742.  
  2743. /*******************************************/
  2744. /* RexxRegisterExitDll registers an       */
  2745. /*  exit handler that resides in a         */
  2746. /*  dynamic link library routine.          */
  2747. /*******************************************/
  2748.  
  2749. #define INCL_RXSYSEXIT      /* Exit handler values */
  2750.  
  2751. PSZ     name;         /* handler name */
  2752. PSZ     library;      /* DLL name     */
  2753. PSZ     routine;      /* routine name */
  2754. ULONG   rc;           /* Return code  */
  2755. ULONG   userdata[2];  /* save userdata*/
  2756.  
  2757. rc = RexxRegisterExitDll(name, library, routine,
  2758.      userdata, RXEXIT_DROPPABLE);
  2759.  
  2760.  
  2761. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2762.  
  2763. RexxRegisterExitDll registers an exit handler that resides in a dynalink 
  2764. library routine. 
  2765.  
  2766.  
  2767. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2768.  
  2769. RexxRegisterExitDll (ExitName, ModuleName, EntryPoint, UserArea, DropAuth) 
  2770.  
  2771. Parameters: 
  2772.  
  2773.  EnvName (PSZ) - input 
  2774.     Address of an ASCIIZ exit handler name. 
  2775.  
  2776.  ModuleName (PSZ) - input 
  2777.     Address of an ASCIIZ dynamic link library name. ModuleName is the DLL file 
  2778.     containing the exit handler routine. 
  2779.  
  2780.  EntryPoint (PSZ) - input 
  2781.     Address of an ASCIIZ dynalink procedure name. EntryPoint is the exit 
  2782.     handler routine within ModuleName. 
  2783.  
  2784.  UserArea (PUCHAR) - input 
  2785.     Address of an 8-byte area of user defined information. The 8 bytes 
  2786.     addressed by UserArea will be saved with the exit handler registration. 
  2787.     UserArea can be NULL if there is no user information to save. The saved 
  2788.     user information can be retrieved with the RexxQueryExit function. 
  2789.  
  2790.  DropAuth (ULONG) - input 
  2791.     The drop authority. DropAuth identifies the processes that can deregister 
  2792.     the exit handler. The possible DropAuth values are: 
  2793.  
  2794.     RXEXIT_DROPPABLE 
  2795.             Any process can deregister the exit handler with 
  2796.             RexxDeregisterExit. 
  2797.  
  2798.     RXEXIT_NONDROP 
  2799.             Only a thread within the same process as the thread that registered 
  2800.             the handler can deregister the handler with RexxDeregisterExit. 
  2801.  
  2802.  
  2803. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2804.  
  2805. RexxRegisterExitDll returns the following values: 
  2806.  
  2807.  0         RXEXIT_OK 
  2808.  10        RXEXIT_DUP 
  2809.  1002      RXEXIT_NOEMEM 
  2810.  1003      RXEXIT_BADTYPE 
  2811.  
  2812.  
  2813. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2814.  
  2815. EntryPoint can be either a 16-bit or a 32-bit routine. REXX will invoke the 
  2816. exit handler in the correct addressing mode. 
  2817.  
  2818.  
  2819. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterExitDll ΓòÉΓòÉΓòÉ
  2820.  
  2821. The following functions are related to RexxRegisterExitDll: 
  2822.  
  2823.       RexxRegisterExitExe 
  2824.       RexxDeregisterExit 
  2825.       RexxQueryExit 
  2826.  
  2827.  
  2828. ΓòÉΓòÉΓòÉ 12.2. RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2829.  
  2830.  
  2831. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  2832.  
  2833. Topics: 
  2834.  
  2835.       Call Syntax 
  2836.       Uses 
  2837.       Parameters 
  2838.       Return Values 
  2839.       Errors 
  2840.       Notes 
  2841.       Related Functions 
  2842.       Examples 
  2843.  
  2844.  
  2845. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2846.  
  2847. /*******************************************/
  2848. /* RexxRegisterExitDll registers an       */
  2849. /*  exit handler that resides in a         */
  2850. /*  dynamic link library routine.          */
  2851. /*******************************************/
  2852.  
  2853. #define INCL_RXSYSEXITS     /* Exit handler values */
  2854.  
  2855. PSZ     name;         /* handler name */
  2856. PSZ     library;      /* DLL name     */
  2857. PSZ     routine;      /* routine name */
  2858. ULONG   rc;           /* Return code  */
  2859. ULONG   userdata[2];  /* save userdata*/
  2860.  
  2861. rc = RexxRegisterExitDll(name, library, routine,
  2862.      userdata, RXEXIT_DROPPABLE);
  2863.  
  2864.  
  2865. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2866.  
  2867. RexxRegisterExitExe registers an exit handler that resides within application 
  2868. code. 
  2869.  
  2870.  
  2871. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2872.  
  2873. RexxRegisterExitExe (EnvName, EntryPoint, UserArea) 
  2874.  
  2875. Parameters: 
  2876.  
  2877.  EnvName (PSZ) - input 
  2878.     Address of an ASCIIZ exit handler name. 
  2879.  
  2880.  EntryPoint (PFN) - input 
  2881.     Address of the exit handler entry point within the application EXE file. 
  2882.  
  2883.  UserArea (PUCHAR) - input 
  2884.     Address of an 8-byte area of user defined information. The 8 bytes 
  2885.     addressed by UserArea will be saved with the exit handler registration. 
  2886.     UserArea can be NULL if there is no user information to save. The user 
  2887.     information can be retrieved with the RexxQueryExit function. 
  2888.  
  2889.  
  2890. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2891.  
  2892. RexxRegisterExitExe returns the following values: 
  2893.  
  2894.  0         RXEXIT_OK 
  2895.  10        RXEXIT_DUP 
  2896.  30        RXEXIT_NOTREG 
  2897.  1002      RXEXIT_NOEMEM 
  2898.  1003      RXEXIT_BADTYPE 
  2899.  
  2900.  
  2901. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2902.  
  2903. If EnvName has the same name as a handler registered with RexxRegisterExitDll, 
  2904. RexxRegisterExitExe will return RXEXIT_DUP. This is not an error and the new 
  2905. exit handler has been properly registered. 
  2906.  
  2907.  
  2908. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2909.  
  2910. The following functions are related to RexxRegisterExitExe: 
  2911.  
  2912.       RexxRegisterExitDll 
  2913.       RexxDeregisterExit 
  2914.       RexxQueryExit 
  2915.  
  2916.  
  2917. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxRegisterExitExe ΓòÉΓòÉΓòÉ
  2918.  
  2919. The following example shows the use of RexxRegisterExitExe: 
  2920.  
  2921.   WORKAREARECORD  *user_info[2];       /* saved user information     */
  2922.  
  2923.   user_info[0] = global_workarea;      /* save global work area for  */
  2924.   user_info[1] = NULL;                 /* re-entrancy                */
  2925.  
  2926.   rc = RexxRegisterExitExe("IO_Exit",  /* register editor handler    */
  2927.       &Edit_IO_Exit,                   /* located at this address    */
  2928.       user_info);                      /* save global pointer        */
  2929.  
  2930.  
  2931. ΓòÉΓòÉΓòÉ 12.3. RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2932.  
  2933.  
  2934. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  2935.  
  2936. Topics: 
  2937.  
  2938.       Call Syntax 
  2939.       Uses 
  2940.       Parameters 
  2941.       Return Values 
  2942.       Errors 
  2943.       Notes 
  2944.       Related Functions 
  2945.  
  2946.  
  2947. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2948.  
  2949. /*******************************************/
  2950. /* RexxDeregisterExit deregisters an       */
  2951. /*  exit handler.                          */
  2952. /*******************************************/
  2953.  
  2954. #define INCL_RXSYSEXIT      /* Exit handler values */
  2955.  
  2956. PSZ     name;       /* handler name       */
  2957. PSZ     library     /* handler dll        */
  2958. ULONG   rc;         /* Return code */
  2959.  
  2960. rc = RexxDeregisterExit(name, library);
  2961.  
  2962.  
  2963. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2964.  
  2965. RexxDeregisterExit deregisters an exit handler. 
  2966.  
  2967.  
  2968. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2969.  
  2970. RexxDeregisterExit (EnvName, ModuleName) 
  2971.  
  2972. Parameters: 
  2973.  
  2974.  EnvName (PSZ) - input 
  2975.     Address of an ASCIIZ exit handler name. 
  2976.  
  2977.  ModuleName (PSZ) - input 
  2978.     Address of an ASCIIZ dynamic link library name. ModuleName restricts the 
  2979.     query to an exit handler within the ModuleName dynamic link library. When 
  2980.     ModuleName is NULL, RexxDeregisterExit searches the RexxRegisterExitExe 
  2981.     exit handler list for a handler within the current process. If 
  2982.     RexxDeregisterExit does not find a RexxRegisterExitExe handler, it will 
  2983.     search the RexxRegisterExitDll exit handler list. 
  2984.  
  2985.  
  2986. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2987.  
  2988. RexxDeregisterExit returns the following values: 
  2989.  
  2990.  0         RXEXIT_OK 
  2991.  30        RXEXIT_NOTREG 
  2992.  40        RXEXIT_NOCANDROP 
  2993.  1003      RXEXIT_BADTYPE 
  2994.  
  2995.  
  2996. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  2997.  
  2998. The handler is removed from the exit handler list. 
  2999.  
  3000.  
  3001. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxDeregisterExit ΓòÉΓòÉΓòÉ
  3002.  
  3003. The following functions are related to RexxDeregisterExit: 
  3004.  
  3005.       RexxRegisterExitDll 
  3006.       RexxRegisterExitExe 
  3007.       RexxQueryExit 
  3008.  
  3009.  
  3010. ΓòÉΓòÉΓòÉ 12.4. RexxQueryExit ΓòÉΓòÉΓòÉ
  3011.  
  3012.  
  3013. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3014.  
  3015. Topics: 
  3016.  
  3017.       Call Syntax 
  3018.       Uses 
  3019.       Parameters 
  3020.       Return Values 
  3021.       Errors 
  3022.       Related Functions 
  3023.       Examples 
  3024.  
  3025.  
  3026. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxQueryExit ΓòÉΓòÉΓòÉ
  3027.  
  3028. /*******************************************/
  3029. /* RexxQueryExit queries an exit          */
  3030. /*  handler and retrieves saved user       */
  3031. /*  information.                           */
  3032. /*******************************************/
  3033.  
  3034. #define INCL_RXSYSEXIT      /* subcommand handler values */
  3035.  
  3036. PSZ     name;         /* handler name */
  3037. PSZ     library;      /* DLL name     */
  3038. ULONG   userdata[2];  /* saved information */
  3039. ULONG   rc;         /* Return code */
  3040.  
  3041. rc = RexxQueryExit(name, library, userdata);
  3042.  
  3043.  
  3044. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxQueryExit ΓòÉΓòÉΓòÉ
  3045.  
  3046. RexxQueryExit queries an exit handler and retrieves saved user information. 
  3047.  
  3048.  
  3049. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxQueryExit ΓòÉΓòÉΓòÉ
  3050.  
  3051. RexxQueryExit (EnvName, ModuleName, Flag, UserWord) 
  3052.  
  3053. Parameters: 
  3054.  
  3055.  EnvName (PSZ) - input 
  3056.     Address of an ASCIIZ exit handler name. 
  3057.  
  3058.  ModuleName (PSZ) - input 
  3059.     ModuleName restricts the query to an exit handler within the ModuleName 
  3060.     dynamic link library. When ModuleName is NULL, RexxQueryExit searches the 
  3061.     RexxRegisterExitExe exit handler list for a handler within the current 
  3062.     process. If RexxQueryExit does not find a RexxRegisterExitExe handler, it 
  3063.     will search the RexxRegisterExitDll exit handler list. 
  3064.  
  3065.  Flag (PUSHORT) - output 
  3066.     Exit handler registration flag. Flag is the EnvName exit handler 
  3067.     registration status. When RexxQueryExit returns RXEXIT_OK, the EnvName exit 
  3068.     handler is currently registered. When RexxQueryExit returns RXEXIT_NOTREG, 
  3069.     the EnvName exit handler is not registered. 
  3070.  
  3071.  Flag (PUSHORT) - output 
  3072.     Exit handler registration flag. Flag indicates if the EnvName exit handler 
  3073.     is registered. If Flag is RXEXIT_OK, the EnvName exit handler is not 
  3074.     registered. If Flag is RXEXIT_NOTREG, the EnvName exit handler is 
  3075.     registered. 
  3076.  
  3077.  UserWord (PUCHAR) - output 
  3078.     Address of an 8-byte area to receive the user information saved with 
  3079.     RexxRegisterExitExe or RexxRegisterExitDll. UserWord can be NULL if the 
  3080.     saved user information is not required. 
  3081.  
  3082.  
  3083. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxQueryExit ΓòÉΓòÉΓòÉ
  3084.  
  3085. RexxQueryExit returns the following values: 
  3086.  
  3087.  0         RXEXIT_OK 
  3088.  30        RXEXIT_NOTREG 
  3089.  1003      RXEXIT_BADTYPE 
  3090.  
  3091.  
  3092. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxQueryExit ΓòÉΓòÉΓòÉ
  3093.  
  3094. The following functions are related to RexxQueryExit: 
  3095.  
  3096.       RexxRegisterExitDll 
  3097.       RexxRegisterExitExe 
  3098.       RexxDeregisterExit 
  3099.  
  3100.  
  3101. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxQueryExit ΓòÉΓòÉΓòÉ
  3102.  
  3103. The following example shows the use of RexxQueryExit: 
  3104.  
  3105. ULONG Edit_IO_Exit(
  3106.   PRXSTRING Command,    /* Command string passed from the caller    */
  3107.   PUSHORT   Flags,      /* pointer to short for return of flags     */
  3108.   PRXSTRING Retstr)     /* pointer to RXSTRING for RC return        */
  3109. {
  3110.   WORKAREARECORD  *user_info[2];       /* saved user information     */
  3111.   WORKAREARECORD   global_workarea;    /* application data anchor    */
  3112.   USHORT           query_flag;         /* flag for handler query     */
  3113.  
  3114.  
  3115.   rc = RexxQueryExit("IO_Exit",        /* retrieve application work  */
  3116.       NULL,                            /* area anchor from REXX.     */
  3117.       &query_flag,
  3118.       user_info);
  3119.  
  3120.   global_workarea = user_info[0];      /* set the global anchor      */
  3121.  
  3122.  
  3123. ΓòÉΓòÉΓòÉ <hidden> System Exit Interface Errors ΓòÉΓòÉΓòÉ
  3124.  
  3125. The following are the exit handler function errors.: 
  3126.  
  3127.  RXEXIT_NOEMEM 
  3128.     There is insufficient memory available to complete this request. 
  3129.  
  3130.  RXEXIT_OK 
  3131.     An exit function has executed successfully. 
  3132.  
  3133.  RXEXIT_DUP 
  3134.     A duplicate exit handler name has been successfully registered; there is 
  3135.     either: 
  3136.  
  3137.         an EXE handler with the same name registered in another process, or 
  3138.  
  3139.         a DLL handler with the same name registered in another DLL; to address 
  3140.          this exit, its library name must be specified. 
  3141.  
  3142.  RXEXIT_NOTREG 
  3143.     This indicates: 
  3144.  
  3145.         registration was unsuccessful due to duplicate handler and dynalink 
  3146.          names (RexxRegisterExitExe or RexxRegisterExitDll) 
  3147.  
  3148.         the exit handler is not registered (other REXX exit functions). 
  3149.  
  3150.  RXEXIT_NOCANDROP 
  3151.     The exit handler has been registered as "not droppable". 
  3152.  
  3153.  
  3154. ΓòÉΓòÉΓòÉ 13. Variable Pool Interface ΓòÉΓòÉΓòÉ
  3155.  
  3156. Application programs can use the REXX Variable Pool Interface to manipulate the 
  3157. variables of a currently active REXX procedure. 
  3158.  
  3159.  
  3160. ΓòÉΓòÉΓòÉ 13.1. Interface Types ΓòÉΓòÉΓòÉ
  3161.  
  3162. Three of the Variable Pool Interface functions (set, fetch and drop) have dual 
  3163. interfaces. 
  3164.  
  3165.  
  3166. ΓòÉΓòÉΓòÉ 13.1.1. Symbolic Interface ΓòÉΓòÉΓòÉ
  3167.  
  3168. The symbolic interface uses normal REXX variable rules when interpreting 
  3169. variables. Variable names are valid REXX symbols (in mixed case if desired) 
  3170. including compound symbols. Compound symbols will be referenced with tail 
  3171. substitution. The functions that use the symbolic interface are RXSHV_SYSET, 
  3172. RXSHV_SYFET, and RXSHV_SYDRO. 
  3173.  
  3174.  
  3175. ΓòÉΓòÉΓòÉ 13.1.2. Direct Interface ΓòÉΓòÉΓòÉ
  3176.  
  3177. The direct interface uses no substitution or case translation. Simple symbols 
  3178. must be valid REXX variable names. A valid REXX variable name: 
  3179.  
  3180.      Does not begin with a digit or period 
  3181.  
  3182.      Contains only uppercase A to Z, the digits 0 - 9, or the characters _, ! 
  3183.       or ? before the first period of the name. 
  3184.  
  3185.      Can contain any characters after the first period of the name. 
  3186.  
  3187.  Compound variables are specified using the derived name of the variable.  Any 
  3188.  characters (including blanks) can appear after the first period of the name. 
  3189.  No additional variable sustitution is used. The direct interface is used by 
  3190.  RXSHV_SET, RXSHV_FETCH, and RXSHV_DROP. 
  3191.  
  3192.  
  3193. ΓòÉΓòÉΓòÉ 13.2. RexxVariablePool Restrictions ΓòÉΓòÉΓòÉ
  3194.  
  3195. Only the main thread of an application can access the REXX variable pool. 
  3196. Applications can create and use new threads, but only the original thread that 
  3197. called the RexxStart function can use RexxVariablePool. 
  3198.  
  3199. OS/2* operating system EXE modules invoked from a REXX procedure execute in a 
  3200. new process. Because the modules are not using the same process and thread as 
  3201. the REXX procedure, the modules cannot use RexxVariablePool to access REXX 
  3202. variables. RexxVariablePool can be used from subcommand handlers, external 
  3203. functions and exit handlers. 
  3204.  
  3205.  
  3206. ΓòÉΓòÉΓòÉ 14. RexxVariablePool Interface Function ΓòÉΓòÉΓòÉ
  3207.  
  3208. REXX procedure variables are accessed using the RexxVariablePool function. 
  3209.  
  3210.  
  3211. ΓòÉΓòÉΓòÉ 14.1. RexxVariablePool ΓòÉΓòÉΓòÉ
  3212.  
  3213.  
  3214. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3215.  
  3216. Topics: 
  3217.  
  3218.       Call Syntax 
  3219.       Uses 
  3220.       Parameters 
  3221.       Data Structures 
  3222.       Return Values 
  3223.       Notes 
  3224.       Examples 
  3225.  
  3226.  
  3227. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxVariablePool ΓòÉΓòÉΓòÉ
  3228.  
  3229. /*******************************************/
  3230. /* RexxVariablePool accesses variables   */
  3231. /*  of a currently active REXX procedure.  */
  3232. /*******************************************/
  3233.  
  3234. #define INCL_RXSHV    /* Shared variable values */
  3235.  
  3236. SHVBLOCK  request;    /* request block */
  3237. ULONG     rc;         /* Return code */
  3238.  
  3239. rc = RexxVariablePool(&request);
  3240.  
  3241.  
  3242. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxVariablePool ΓòÉΓòÉΓòÉ
  3243.  
  3244. RexxVariablePool accesses variables of a currently active REXX procedure. 
  3245.  
  3246.  
  3247. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxVariablePool ΓòÉΓòÉΓòÉ
  3248.  
  3249. RexxVariablePool (RequestBlockList) 
  3250.  
  3251. Parameters: 
  3252.  
  3253.  RequestBlockList (PSHVBLOCK) - input 
  3254.     A linked list of shared variable request blocks (SHVBLOCK). Each shared 
  3255.     variable request block in the linked list is a separate variable access 
  3256.     request. 
  3257.  
  3258.  
  3259. ΓòÉΓòÉΓòÉ <hidden> Data Structures - RexxVariablePool ΓòÉΓòÉΓòÉ
  3260.  
  3261. typedef struct shvnode {
  3262.     struct shvnode    *shvnext;
  3263.     RXSTRING           shvname;
  3264.     RXSTRING           shvvalue;
  3265.     ULONG              shvnamelen;
  3266.     ULONG              shvvaluelen;
  3267.     UCHAR              shvcode;
  3268.     UCHAR              shvret;
  3269. }   SHVBLOCK;
  3270.  
  3271. Where: 
  3272.  
  3273.  shvnext 
  3274.     The address of the next SHVBLOCK in the request list. shvnext is NULL for 
  3275.     the last request block. 
  3276.  
  3277.  shvcode 
  3278.     The shared variable block request code. The request codes are: 
  3279.  
  3280.     RXSHV_SET 
  3281.  
  3282.     RXSHV_SYSET 
  3283.             Assign a new value to a REXX procedure variable. 
  3284.  
  3285.     RXSHV_FETCH 
  3286.  
  3287.     RXSHV_SYFETCH 
  3288.             Retrieve the value of a REXX procedure variable. 
  3289.  
  3290.     RXSHV_DROPV 
  3291.  
  3292.     RXSHV_SYDRO 
  3293.             Drop (unassign) a REXX procedure variable. 
  3294.  
  3295.     RXSHV_PRIV 
  3296.             Fetch REXX procedure private information. The following information 
  3297.             items can be retrieved by name: 
  3298.  
  3299.             PARM 
  3300.                     The number of arguments supplied to the REXX procedure. The 
  3301.                     number will be formatted as a character string. 
  3302.  
  3303.             PARM.n 
  3304.                     The Nth argument string to the REXX procedure. If the Nth 
  3305.                     argument was not supplied to the procedure (either omitted 
  3306.                     or fewer than N parameters were specified), a null string 
  3307.                     will be returned. 
  3308.  
  3309.             QUENAME 
  3310.                     The current REXX data queue name. 
  3311.  
  3312.             SOURCE 
  3313.                     The REXX procedure source string used for the PARSE SOURCE 
  3314.                     instruction. 
  3315.  
  3316.             VERSION 
  3317.                     The REXX interpreter version string used for the PARSE 
  3318.                     SOURCE instruction. 
  3319.  
  3320.     RXSHV_NEXTV 
  3321.             Fetch next variable. RXSHV_NEXTV traverses the variables in the 
  3322.             current generation of REXX variables, excluding variables hidden by 
  3323.             PROCEDURE instructions. The variables will not be returned in any 
  3324.             specified order. 
  3325.  
  3326.             The REXX interpreter maintains an internal pointer to its list of 
  3327.             variables. The variable pointers is reset to the first REXX 
  3328.             variable whenever: c. 
  3329.  
  3330.               1. An external program returns control to the interpreter 
  3331.  
  3332.               2. A set, fetch or drop RexxVariablePool function is used. 
  3333.  
  3334.             RXSHV_NEXTV returns both the name and the value of REXX variables 
  3335.             until the end of the variable list is reached. If no REXX variables 
  3336.             are left to return, RexxVariablePool will set the RXSHV_LVAR bit in 
  3337.             shvret. 
  3338.  
  3339.     RXSHV_EXIT 
  3340.             Set a return value for an external function or exit handler. 
  3341.             RXSHV_EXIT is only valid from external functions or exit events 
  3342.             that return a string value. RXSHV_EXIT can only be used once by an 
  3343.             external function or exit handler. 
  3344.  
  3345.  shvret 
  3346.     Individual shared variable request return code. shvret is a 1-byte field of 
  3347.     status flags for the individual shared variable request. The shvret fields 
  3348.     for all request blocks in the list are ORed together to form the 
  3349.     RexxVariablePool return code. The individual status conditions are: 
  3350.  
  3351.     RXSHV_OK 
  3352.             The request was processed with out error (all flag bits are FALSE). 
  3353.  
  3354.     RXSHV_NEWV 
  3355.             The named variable was uninitialized. 
  3356.  
  3357.     RXSHV_LVAR 
  3358.             No more variables are available for an RXSHV_NEXTV operation. 
  3359.  
  3360.     RXSHV_TRUNC 
  3361.             A variable value or variable name was truncated because the 
  3362.             supplied RXSTRING was too small for the copied value. 
  3363.  
  3364.     RXSHV_BADN 
  3365.             The variable name specified in shvname was invalid for the 
  3366.             requested operation. 
  3367.  
  3368.     RXSHV_MEMFL 
  3369.             The REXX interpreter was unable to obtain the storage required to 
  3370.             complete the request. 
  3371.  
  3372.     RXSHV_BADF 
  3373.             The shared variable request block contains an invalid function 
  3374.             code. 
  3375.  
  3376.  shvname 
  3377.     An RXSTRING containing a REXX variable name. shvname usage varies for the 
  3378.     different SHVBLOCK request codes: 
  3379.  
  3380.     RXSHV_SET 
  3381.  
  3382.     RXSHV_SYSET 
  3383.  
  3384.     RXSHV_FETCH 
  3385.  
  3386.     RXSHV_SYFET 
  3387.  
  3388.     RXSHV_DROPV 
  3389.  
  3390.     RXSHV_SYDRO 
  3391.  
  3392.     RXSHV_PRIV 
  3393.             shvname is an RXSTRING pointing to the name of the REXX variable 
  3394.             accessed by the shared variable request block. 
  3395.  
  3396.     RXSHV_NEXTV 
  3397.             shvname is an RXSTRING defining an area of storage to receive the 
  3398.             name of the next variable. shvnamelen is the length of the RXSTRING 
  3399.             area. If the variable name is longer than shvnamelen characters, 
  3400.             the name will be truncated and the RXSHV_TRUNC bit of shvret will 
  3401.             be set. On return, shvname.strlength will contain the length of the 
  3402.             variable name; shvnamelen will be unchanged. 
  3403.  
  3404.             If shvname is an empty RXSTRING (strptr is NULL), the REXX 
  3405.             interpreter will allocate and return an RXSTRING to hold the 
  3406.             variable name. If the REXX interpreter allocates the RXSTRING, an 
  3407.             RXSHV_TRUNC condition cannot occur. However, RXSHV_MEMFL errors are 
  3408.             possible for these operations. If an RXSHV_MEMFL condition occurs, 
  3409.             memory will not be allocated for that request block. The 
  3410.             RexxVariablePool function caller must release the storage with 
  3411.             "DosFreeMem". 
  3412.  
  3413.             Note:  The RexxVariablePool does not add a terminating null 
  3414.                    character to the variable name. 
  3415.  
  3416.     RXSHV_EXIT 
  3417.             shvname is unused for the RXSHV_EXIT function. 
  3418.  
  3419.  shvvalue 
  3420.     An RXSTRING containing a REXX variable value. shvvalue meaning varies for 
  3421.     the different SHVBLOCK request codes: 
  3422.  
  3423.     RXSHV_SET 
  3424.  
  3425.     RXSHV_SYSET 
  3426.             shvvalue is the value assigned to the REXX variable in shvname. 
  3427.             shvvaluelen contains the length of the variable value. 
  3428.  
  3429.     RXSHV_EXIT 
  3430.             shvvalue is the value assigned to the exit handler return value. 
  3431.             shvvaluelen contains the length of the variable value. 
  3432.  
  3433.     RXSHV_FETCH 
  3434.  
  3435.     RXSHV_SYFET 
  3436.  
  3437.     RXSHV_PRIV 
  3438.  
  3439.     RXSHV_NEXT 
  3440.             shvvalue is a buffer the REXX interpreter uses to return a copy of 
  3441.             REXX variable shvname. shvvaluelen contains the length of the value 
  3442.             buffer. On return, shvvalue.strlength will be set to the length of 
  3443.             the returned value and shvvaluelen will be unchanged. If the 
  3444.             variable value is longer than shvvaluelen characters, the value 
  3445.             will be truncated and the RXSHV_TRUNC bit of shvret will be set. On 
  3446.             return, shvvalue.strlength will be set to the length of the 
  3447.             returned value; shvvaluelen will be unchanged. 
  3448.  
  3449.             If shvvalue is an empty RXSTRING (strptr is NULL), the REXX 
  3450.             interpreter will allocate and return an RXSTRING to hold the 
  3451.             variable value. If the REXX interpreter allocates the RXSTRING, an 
  3452.             RXSHV_TRUNC condition cannot occur. However, RXSHV_MEMFL errors are 
  3453.             possible for these operations. If an RXSHV_MEMFL condition occurs, 
  3454.             memory will not be allocated for that request block. The 
  3455.             RexxVariablePool function caller must release the storage with 
  3456.             "DosFreeMem". 
  3457.  
  3458.             Note:  RexxVariablePool does not add a terminating null character 
  3459.                    to the variable value. 
  3460.  
  3461.     RXSHV_DROPV 
  3462.  
  3463.     RXSHV_SYDRO 
  3464.             shvvalue is not used. 
  3465.  
  3466.  
  3467. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxVariablePool ΓòÉΓòÉΓòÉ
  3468.  
  3469. RexxVariablePool returns the following values: 
  3470.  
  3471.  0 to 127 
  3472.     RexxVariablePool has processed the entire shared variable request block 
  3473.     list. 
  3474.  
  3475.     The RexxVariablePool function return code is a composite return code for 
  3476.     the entire set of shared variable requests. The low-order 6 bits of the the 
  3477.     shvret fields for all request blocks are ORed together to form the 
  3478.     composite return code. Individual shared variable request status flags are 
  3479.     returned in the shared variable request block shvret field. 
  3480.  
  3481.  RXSHV_NOAVL 
  3482.     The variable pool interface was not enabled. 
  3483.  
  3484.  
  3485. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxVariablePool ΓòÉΓòÉΓòÉ
  3486.  
  3487. The REXX interpreter processes each request block in the order provided; the 
  3488. RexxVariablePool function returns when the last block is processed or after a 
  3489. severe error (such as an out-of-memory condition). 
  3490.  
  3491. The RexxVariablePool function return code is a composite return code for the 
  3492. entire set of shared variable requests. The return codes for all of the 
  3493. individual requests are ORed together to form the composite return code. 
  3494. Individual shared variable request return code are returned in the request 
  3495. shared variable blocks. 
  3496.  
  3497.  
  3498. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxVariablePool ΓòÉΓòÉΓòÉ
  3499.  
  3500. /*********************************************************************/
  3501. /*                                                                   */
  3502. /* SetRexxVariable - Set the value of a REXX variable                */
  3503. /*                                                                   */
  3504. /*********************************************************************/
  3505.  
  3506. INT SetRexxVariable(
  3507.   PSZ        name,                     /* REXX variable to set       */
  3508.   PSZ        value);                   /* value to assign            */
  3509. {
  3510.   SHVBLOCK   block;                    /* variable pool control block*/
  3511.  
  3512.   block.shvcode = RXSHV_SYSET;         /* do a symbolic set operation*/
  3513.   block.shvret=(UCHAR)0;               /* clear return code field    */
  3514.   block.shvnext=(PSHVBLOCK)0;          /* no next block              */
  3515.                                        /* set variable name string   */
  3516.   MAKERXSTRING(block.shvname, name, strlen(name));
  3517.                                        /* set value string           */
  3518.   MAKERXSTRING(block.shvvalue, value, strlen(value));
  3519.   block.shvvaluelen=strlen(value);     /* set value length           */
  3520.   return RexxVariablePool(&block);     /* set the variable           */
  3521. }
  3522.  
  3523.  
  3524. ΓòÉΓòÉΓòÉ 15. Halt and Trace Interface ΓòÉΓòÉΓòÉ
  3525.  
  3526. The halt and trace functions raise a REXX HALT condition or change the REXX 
  3527. interactive debug mode while a REXX procedure is running. These interfaces may 
  3528. be preferred over the RXHLT and RXTRC system exits. The REXX calls the RXTRC 
  3529. exit handler after each REXX instruction completes. This might cause a 
  3530. noticable performance degradation. The Halt and Trace functions are a single 
  3531. request to change the halt or trace state, and do not degrade the REXX 
  3532. procedure performance. 
  3533.  
  3534.      RexxSetHalt raises a HALT condition in a running REXX program. 
  3535.  
  3536.      RexxSetTrace turns on interactive debug mode for a REXX procedure. 
  3537.  
  3538.      RexxResetTrace turns off interactive debug mode for a REXX procedure. 
  3539.  
  3540.  
  3541. ΓòÉΓòÉΓòÉ 16. Halt and Trace Functions ΓòÉΓòÉΓòÉ
  3542.  
  3543.      RexxSetHalt raises a HALT condition in a running REXX program. 
  3544.  
  3545.      RexxSetTrace turns on interactive debug mode for a REXX procedure. 
  3546.  
  3547.      RexxResetTrace turns off interactive debug mode for a REXX procedure. 
  3548.  
  3549.  
  3550. ΓòÉΓòÉΓòÉ 16.1. RexxSetHalt ΓòÉΓòÉΓòÉ
  3551.  
  3552.  
  3553. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3554.  
  3555. Topics: 
  3556.  
  3557.       Call Syntax 
  3558.       Uses 
  3559.       Parameters 
  3560.       Return Values 
  3561.       Notes 
  3562.  
  3563.  
  3564. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxSetHalt ΓòÉΓòÉΓòÉ
  3565.  
  3566. /*******************************************/
  3567. /* RexxSetHalt raises a HALT condition    */
  3568. /*  in a running REXX program.             */
  3569. /*******************************************/
  3570.  
  3571. #define INCL_RXARI     /* Halt and Trace values */
  3572.  
  3573. TID     ThreadId;   /* Thread of REXX program  */
  3574. PID     ProcessId;  /* Process of REXX program */
  3575. ULONG   rc;         /* Return code             */
  3576.  
  3577. rc = RexxSetHalt(ProcessId, ThreadId);
  3578.  
  3579.  
  3580. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxSetHalt ΓòÉΓòÉΓòÉ
  3581.  
  3582. RexxSetHalt raises a HALT condition in a running REXX program. 
  3583.  
  3584.  
  3585. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxSetHalt ΓòÉΓòÉΓòÉ
  3586.  
  3587. RexxSetHalt (ProcessId, ThreadId) 
  3588.  
  3589. Parameters: 
  3590.  
  3591.  ProcessId (PID) - input 
  3592.     The process ID of the target REXX procedure. ProcessId is the application 
  3593.     process that called the RexxStart function. 
  3594.  
  3595.  ThreadId (TID) - input 
  3596.     The thread ID of the target REXX procedure. ThreadId is the application 
  3597.     thread that called the RexxStart function. 
  3598.  
  3599.  
  3600. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxSetHalt ΓòÉΓòÉΓòÉ
  3601.  
  3602. RexxSetHalt returns the following values: 
  3603.  
  3604.  0         RXARI_OK 
  3605.  1         RXARI_PID_TID_NOT_FOUND 
  3606.  2         RXARI_PROCESSING_ERROR 
  3607.  
  3608.  
  3609. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxSetHalt ΓòÉΓòÉΓòÉ
  3610.  
  3611. This function will not be processed if the target REXX program is executing 
  3612. with the RXHLT exit enabled. 
  3613.  
  3614.  
  3615. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxSetHalt ΓòÉΓòÉΓòÉ
  3616.  
  3617. The following functions are related to RexxSetHalt: 
  3618.  
  3619.       RexxSetTrace 
  3620.       RexxResetTrace 
  3621.  
  3622.  
  3623. ΓòÉΓòÉΓòÉ 16.2. RexxSetTrace ΓòÉΓòÉΓòÉ
  3624.  
  3625.  
  3626. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3627.  
  3628. Topics: 
  3629.  
  3630.       Call Syntax 
  3631.       Uses 
  3632.       Parameters 
  3633.       Return Values 
  3634.       Notes 
  3635.  
  3636.  
  3637. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxSetTrace ΓòÉΓòÉΓòÉ
  3638.  
  3639. /*******************************************/
  3640. /* RexxSetTrace turns on interactive      */
  3641. /*  debug mode for REXX procedure.         */
  3642. /*******************************************/
  3643.  
  3644. #define INCL_RXARI     /* Halt and Trace values */
  3645.  
  3646. TID     ThreadId;   /* Thread of REXX program  */
  3647. PID     ProcessId;  /* Process of REXX program */
  3648. ULONG   rc;         /* Return code             */
  3649.  
  3650. rc = RexxSetTrace(ProcessId, ThreadId);
  3651.  
  3652.  
  3653. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxSetTrace ΓòÉΓòÉΓòÉ
  3654.  
  3655. RexxSetTrace turns on interactive debug mode for a REXX procedure. 
  3656.  
  3657.  
  3658. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxSetTrace ΓòÉΓòÉΓòÉ
  3659.  
  3660. RexxSetTrace (ProcessId, ThreadId) 
  3661.  
  3662. Parameters: 
  3663.  
  3664.  ProcessId (PID) - input 
  3665.     The process ID of the target REXX procedure. ProcessId is the application 
  3666.     process that called the RexxStart function. 
  3667.  
  3668.  ThreadId (TID) - input 
  3669.     The thread ID of the target REXX procedure. ThreadId is the application 
  3670.     thread that called the RexxStart function. 
  3671.  
  3672.  
  3673. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxSetTrace ΓòÉΓòÉΓòÉ
  3674.  
  3675. RexxSetTrace returns the following values: 
  3676.  
  3677.  0         RXARI_OK 
  3678.  1         RXARI_PID_TID_NOT_FOUND 
  3679.  2         RXARI_PROCESSING_ERROR 
  3680.  
  3681.  
  3682. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxSetTrace ΓòÉΓòÉΓòÉ
  3683.  
  3684. The RexxSetTrace function is not processed if the REXX procedure is using the 
  3685. RXTRC exit. 
  3686.  
  3687.  
  3688. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxSetTrace ΓòÉΓòÉΓòÉ
  3689.  
  3690. The following functions are related to RexxSetTrace: 
  3691.  
  3692.       RexxSetHalt 
  3693.       RexxResetTrace 
  3694.  
  3695.  
  3696. ΓòÉΓòÉΓòÉ 16.3. RexxResetTrace ΓòÉΓòÉΓòÉ
  3697.  
  3698.  
  3699. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3700.  
  3701. Topics: 
  3702.  
  3703.       Call Syntax 
  3704.       Uses 
  3705.       Parameters 
  3706.       Return Values 
  3707.       Notes 
  3708.  
  3709.  
  3710. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxResetTrace ΓòÉΓòÉΓòÉ
  3711.  
  3712. /*******************************************/
  3713. /* RexxResetTrace turns off interactive   */
  3714. /*  debug mode for REXX procedure.         */
  3715. /*******************************************/
  3716.  
  3717. #define INCL_RXARI     /* Halt and Trace values */
  3718.  
  3719. TID     ThreadId;   /* Thread of REXX program  */
  3720. PID     ProcessId;  /* Process of REXX program */
  3721. ULONG   rc;         /* Return code             */
  3722.  
  3723. rc = RexxResetTrace(ProcessId, ThreadId);
  3724.  
  3725.  
  3726. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxResetTrace ΓòÉΓòÉΓòÉ
  3727.  
  3728. RexxResetTrace turns off interactive debug mode for a REXX procedure. 
  3729.  
  3730.  
  3731. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxResetTrace ΓòÉΓòÉΓòÉ
  3732.  
  3733. RexxResetTrace (ProcessId,ThreadId) 
  3734.  
  3735. Parameters: 
  3736.  
  3737.  ProcessId (PID) - input 
  3738.     The process ID of the target REXX procedure. ProcessId is the application 
  3739.     process that called the RexxStart function. 
  3740.  
  3741.  ThreadId (TID) - input 
  3742.     The thread ID of the target REXX procedure. The thread ID of the target 
  3743.     REXX procedure. ThreadId is the application thread that called the 
  3744.     RexxStart function. 
  3745.  
  3746.  
  3747. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxResetTrace ΓòÉΓòÉΓòÉ
  3748.  
  3749. RexxResetTrace returns the following values: 
  3750.  
  3751.  0         RXARI_OK 
  3752.  1         RXARI_PID_TID_NOT_FOUND 
  3753.  2         RXARI_PROCESSING_ERROR 
  3754.  
  3755.  
  3756. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxResetTrace ΓòÉΓòÉΓòÉ
  3757.  
  3758. The RexxResetTrace function is not processed if the REXX procedure is using the 
  3759. RXTRC exit. 
  3760.  
  3761. Interactive debug will not be turned off unless interactive debug mode was 
  3762. originally started with RexxSetTrace. 
  3763.  
  3764.  
  3765. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxResetTrace ΓòÉΓòÉΓòÉ
  3766.  
  3767. The following functions are related to RexxResetTrace: 
  3768.  
  3769.       RexxSetHalt 
  3770.       RexxSetTrace 
  3771.  
  3772.  
  3773. ΓòÉΓòÉΓòÉ 17. Macrospace Interface ΓòÉΓòÉΓòÉ
  3774.  
  3775. The macrospace can improve the performance of REXX procedures by maintaining 
  3776. REXX procecure images in memory for immediate load and execution. This is 
  3777. useful for frequently used procedures and functions such as editor macros. 
  3778.  
  3779. Programs registered in the REXX macrospace are available to all processes. They 
  3780. can be executed using the RexxStart function or called as functions or 
  3781. subroutines from other REXX procedures. 
  3782.  
  3783. Macrospace procedures are called as other REXX external functions are called. 
  3784. However, the macrospace REXX procedures can be placed at the front or at the 
  3785. end of the external function search order. 
  3786.  
  3787. REXX procedures in the macrospace can be saved to a disk file. A saved 
  3788. macrospace file can be reloaded with the RexxLoadMacroSpace function. An 
  3789. application, such as an editor, can create a library of frequently-used 
  3790. functions and load the library into the macrospace for fast access. Multiple 
  3791. macrospace libraries can be created and loaded. 
  3792. Search Order 
  3793.  
  3794. When RexxAddMacro loads a REXX procecure into the macrospace, the position in 
  3795. the external function search order is specified. The REXX procedure can be 
  3796. placed before all other forms of external function or after all other external 
  3797. functions. 
  3798.  
  3799.  RXMACRO_SEARCH_BEFORE A function registered with RXMACRO_SEARCH_BEFORE will be 
  3800.            located by the REXX interpreter before any registered functions or 
  3801.            external REXX files. 
  3802.  
  3803.  SEARCH_AFTER Function Registration A function registered with 
  3804.            RXMACRO_SEARCH_AFTER will be located by the REXX interpreter after 
  3805.            any registered functions or external REXX files. 
  3806.  
  3807.  Storage of Macrospace Libraries 
  3808.  
  3809.  Note:  The REXX macrospace is placed in shared memory. The size of the 
  3810.         macrospace is only limited by the amount of memory and swap space 
  3811.         available to the system. However, as the macrospace grows, it limits 
  3812.         the memory available to other processes in the system. Allowing the 
  3813.         macrospace to grow too large might degrade overall system performance 
  3814.         due to increased system swap file access. It is recommended that only 
  3815.         the most frequently used functions be placed in the macrospace. 
  3816.  
  3817.  
  3818. ΓòÉΓòÉΓòÉ 18. Macrospace Interface Functions ΓòÉΓòÉΓòÉ
  3819.  
  3820.      RexxAddMacro loads a REXX procedure into the macrospace. 
  3821.  
  3822.      RexxDropMacro removes a REXX procedure from the macrospace. 
  3823.  
  3824.      RexxClearMacroSpace removes all loaded REXX procedures from the 
  3825.       macrospace. 
  3826.  
  3827.      RexxSaveMacroSpace saves all or part of the macrospace REXX procedures 
  3828.  
  3829.      RexxLoadMacroSpace loads all or part of the REXX procedures from a saved 
  3830.       macrospace file. 
  3831.  
  3832.      RexxQueryMacro searches the macrospace for a specified function. 
  3833.  
  3834.      RexxReorderMacro changes the search order position of a loaded macrospace 
  3835.  
  3836.  
  3837. ΓòÉΓòÉΓòÉ 18.1. RexxAddMacro ΓòÉΓòÉΓòÉ
  3838.  
  3839.  
  3840. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3841.  
  3842. Topics: 
  3843.  
  3844.       Call Syntax 
  3845.       Uses 
  3846.       Parameters 
  3847.       Return Values 
  3848.       Errors 
  3849.       Related Functions 
  3850.       Examples 
  3851.  
  3852.  
  3853. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxAddMacro ΓòÉΓòÉΓòÉ
  3854.  
  3855. /*******************************************/
  3856. /* RexxAddMacro loads a REXX procedure    */
  3857. /*  into the macrospace.                   */
  3858. /*******************************************/
  3859.  
  3860. #define INCL_RXMACRO    /* Macrospace values */
  3861.  
  3862. PSZ     name;       /* function name      */
  3863. PSZ     file;       /* REXX source file   */
  3864. ULONG   rc;         /* Return code        */
  3865.  
  3866. rc = RexxAddMacro(name, file, RXMACRO_SEARCH_BEFORE);
  3867.  
  3868.  
  3869. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxAddMacro ΓòÉΓòÉΓòÉ
  3870.  
  3871. RexxAddMacro loads a REXX procedure into the macrospace. 
  3872.  
  3873.  
  3874. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxAddMacro ΓòÉΓòÉΓòÉ
  3875.  
  3876. RexxAddMacro (FuncName, SourceFile, Position) 
  3877.  
  3878. Parameters: 
  3879.  
  3880.  FuncName (PSZ) - input 
  3881.  
  3882.     Address of the ASCIIZ function name. Macrospace REXX procedures are called 
  3883.     using FuncName. 
  3884.  
  3885.  SourceFile (PSZ) - input 
  3886.     Address of the ASCIIZ file specification for the REXX procedure source 
  3887.     file. When a file extension is not supplied, .CMD is used. When the full 
  3888.     path is not specified, the current directory and path is searched. 
  3889.  
  3890.  Position (ULONG) - input 
  3891.     Position in the REXX external function search order. Possible values are: 
  3892.  
  3893.     RXMACRO_SEARCH_BEFORE 
  3894.             The function will be located by the REXX interpreter before any 
  3895.             registered functions or external REXX files. 
  3896.  
  3897.     RXMACRO_SEARCH_AFTER 
  3898.             The function will be located by the REXX interpreter after any 
  3899.             registered functions or external REXX files. 
  3900.  
  3901.  
  3902. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxAddMacro ΓòÉΓòÉΓòÉ
  3903.  
  3904. RexxAddMacro returns the following values: 
  3905.  
  3906.  0         RXMACRO_OK 
  3907.  1         RXMACRO_NO_STORAGE 
  3908.  7         RXMACRO_SOURCE_NOT_FOUND 
  3909.  8         RXMACRO_INVALID_POSITION 
  3910.  
  3911.  
  3912. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxAddMacro ΓòÉΓòÉΓòÉ
  3913.  
  3914. The following functions are related to RexxAddMacro: 
  3915.  
  3916.       RexxDropMacro 
  3917.       RexxClearMacroSpace 
  3918.       RexxSaveMacroSpace 
  3919.       RexxLoadMacroSpace 
  3920.       RexxQueryMacro 
  3921.       RexxReorderMacro 
  3922.  
  3923.  
  3924. ΓòÉΓòÉΓòÉ 18.2. RexxDropMacro ΓòÉΓòÉΓòÉ
  3925.  
  3926.  
  3927. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3928.  
  3929. Topics: 
  3930.  
  3931.       Call Syntax 
  3932.       Uses 
  3933.       Parameters 
  3934.       Return Values 
  3935.       Errors 
  3936.       Related Functions 
  3937.  
  3938.  
  3939. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxDropMacro ΓòÉΓòÉΓòÉ
  3940.  
  3941. /*******************************************/
  3942. /* RexxDropMacro removes a REXX           */
  3943. /*  procedure from the macrospace.         */
  3944. /*******************************************/
  3945.  
  3946. #define INCL_RXMACRO    /* Macrospace values */
  3947.  
  3948. PSZ     name;       /* function name      */
  3949. ULONG   rc;         /* Return code        */
  3950.  
  3951. rc = RexxDropMacro(name);
  3952.  
  3953.  
  3954. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxDropMacro ΓòÉΓòÉΓòÉ
  3955.  
  3956. RexxDropMacro removes a REXX procedure from the macrospace. 
  3957.  
  3958.  
  3959. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxDropMacro ΓòÉΓòÉΓòÉ
  3960.  
  3961. RexxDropMacro (FuncName) 
  3962.  
  3963. Parameters: 
  3964.  
  3965.  FuncName (PSZ) - input 
  3966.     Address of the ASCIIZ function name. 
  3967.  
  3968.  
  3969. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxDropMacro ΓòÉΓòÉΓòÉ
  3970.  
  3971. RexxDropMacro returns the following values: 
  3972.  
  3973.  0         RXMACRO_OK 
  3974.  2         RXMACRO_NOT_FOUND 
  3975.  
  3976.  
  3977. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxDropMacro ΓòÉΓòÉΓòÉ
  3978.  
  3979. The following functions are related to RexxDropMacro: 
  3980.  
  3981.       RexxAddMacro 
  3982.       RexxClearMacroSpace 
  3983.       RexxSaveMacroSpace 
  3984.       RexxLoadMacroSpace 
  3985.       RexxQueryMacro 
  3986.       RexxReorderMacro 
  3987.  
  3988.  
  3989. ΓòÉΓòÉΓòÉ 18.3. RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  3990.  
  3991.  
  3992. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  3993.  
  3994. Topics: 
  3995.  
  3996.       Call Syntax 
  3997.       Uses 
  3998.       Parameters 
  3999.       Return Values 
  4000.       Errors 
  4001.       Notes 
  4002.       Related Functions 
  4003.  
  4004.  
  4005. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4006.  
  4007. /*******************************************/
  4008. /* RexxClearMacroSpace removes all        */
  4009. /*  REXX procedures from the macrospace    */
  4010. /*******************************************/
  4011.  
  4012. #define INCL_RXMACRO    /* Macrospace values */
  4013.  
  4014. ULONG   rc;         /* Return code        */
  4015.  
  4016. rc = RexxClearMacroSpace();
  4017.  
  4018.  
  4019. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4020.  
  4021. RexxClearMacroSpace removes all loaded REXX procedures from the macrospace. 
  4022.  
  4023.  
  4024. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4025.  
  4026. RexxClearMacroSpace () 
  4027.  
  4028. Parameters: 
  4029.  
  4030. (None) 
  4031.  
  4032.  
  4033. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4034.  
  4035. RexxClearMacroSpace returns the following values: 
  4036.  
  4037.  0         RXMACRO_OK 
  4038.  2         RXMACRO_NOT_FOUND 
  4039.  
  4040.  
  4041. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4042.  
  4043. RexxClearMacroSpace must be used with care. This function will remove all 
  4044. functions from the macrospace, including functions loaded by other processes. 
  4045.  
  4046.  
  4047. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxClearMacroSpace ΓòÉΓòÉΓòÉ
  4048.  
  4049. The following functions are related to RexxClearMacroSpace: 
  4050.  
  4051.       RexxAddMacro 
  4052.       RexxDropMacro 
  4053.       RexxSaveMacroSpace 
  4054.       RexxLoadMacroSpace 
  4055.       RexxQueryMacro 
  4056.       RexxReorderMacro 
  4057.  
  4058.  
  4059. ΓòÉΓòÉΓòÉ 18.4. RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4060.  
  4061.  
  4062. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  4063.  
  4064. Topics: 
  4065.  
  4066.       Call Syntax 
  4067.       Uses 
  4068.       Parameters 
  4069.       Return Values 
  4070.       Errors 
  4071.       Notes 
  4072.       Related Functions 
  4073.       Examples 
  4074.  
  4075.  
  4076. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4077.  
  4078. /*******************************************/
  4079. /* RexxSaveMacroSpace saves all or part   */
  4080. /*  of the macrospace REXX procedures      */
  4081. /*******************************************/
  4082.  
  4083. #define INCL_RXMACRO    /* Macrospace values */
  4084.  
  4085. PSZ     macrolist;  /* list of macros     */
  4086. ULONG   count;      /* size of macrolist  */
  4087. PSZ     file;       /* name of savefile   */
  4088. ULONG   rc;         /* Return code        */
  4089.  
  4090. rc = RexxSaveMacroSpace(count, macrolist, file);
  4091.  
  4092.  
  4093. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4094.  
  4095. RexxSaveMacroSpace saves all or part of the macrospace REXX procedures to a 
  4096. disk file. 
  4097.  
  4098.  
  4099. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4100.  
  4101. RexxSaveMacroSpace (FuncCount, FuncNames, MacroLibFile) 
  4102.  
  4103. Parameters: 
  4104.  
  4105.  FuncCount (ULONG) - input 
  4106.     Number of REXX procedures to save. 
  4107.  
  4108.  FuncNames (PSZ *) - input 
  4109.     Address of a list of ASCIIZ function names. FuncCount gives the size of the 
  4110.     function list. 
  4111.  
  4112.  MacroLibFile (PSZ) - input 
  4113.     Address of the ASCIIZ macrospace file name. If MacroLibFile already exists, 
  4114.     it is replaced with the new file. 
  4115.  
  4116.  
  4117. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4118.  
  4119. RexxSaveMacroSpace returns the following values: 
  4120.  
  4121.  0         RXMACRO_OK 
  4122.  2         RXMACRO_NOT_FOUND 
  4123.  3         RXMACRO_EXTENSION_REQUIRED 
  4124.  5         RXMACRO_FILE_ERROR 
  4125.  
  4126.  
  4127. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4128.  
  4129. When FuncCount is 0 or FuncNames is NULL, RexxSaveMacroSpace saves all 
  4130. functions in the macrospace. 
  4131.  
  4132. Saved macrospace files can only be used with the same interpreter version that 
  4133. created the images. If the RexxLoadMacroSpace function is called to load a 
  4134. saved macrospace, and the release level or service level is incorrect, the 
  4135. RexxLoadMacroSpace function will fail. If RexxLoadMacroSpace fails, the REXX 
  4136. procedures must be reloaded individually from the original source programs. 
  4137.  
  4138.  
  4139. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxSaveMacroSpace ΓòÉΓòÉΓòÉ
  4140.  
  4141. The following functions are related to RexxSaveMacroSpace: 
  4142.  
  4143.       RexxAddMacro 
  4144.       RexxDropMacro 
  4145.       RexxClearMacroSpace 
  4146.       RexxLoadMacroSpace 
  4147.       RexxQueryMacro 
  4148.       RexxReorderMacro 
  4149.  
  4150.  
  4151. ΓòÉΓòÉΓòÉ 18.5. RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4152.  
  4153.  
  4154. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  4155.  
  4156. Topics: 
  4157.  
  4158.       Call Syntax 
  4159.       Uses 
  4160.       Parameters 
  4161.       Return Values 
  4162.       Errors 
  4163.       Notes 
  4164.       Related Functions 
  4165.       Examples 
  4166.  
  4167.  
  4168. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4169.  
  4170. /*******************************************/
  4171. /* RexxLoadMacroSpace loads all or part   */
  4172. /*  of the REXX procedures from a saved    */
  4173. /*  macrospace file.                       */
  4174. /*******************************************/
  4175.  
  4176. #define INCL_RXMACRO    /* Macrospace values */
  4177.  
  4178. PSZ     macrolist;  /* list of macros     */
  4179. ULONG   count;      /* size of macrolist  */
  4180. PSZ     file;       /* name of savefile   */
  4181. ULONG   rc;         /* Return code        */
  4182.  
  4183. rc = RexxLoadMacroSpace(count, macrolist, file);
  4184.  
  4185.  
  4186. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4187.  
  4188. RexxLoadMacroSpace loads all or part of the REXX procedures from a saved 
  4189. macrospace file. 
  4190.  
  4191.  
  4192. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4193.  
  4194. RexxLoadMacroSpace (FuncCount, FuncNames, MacroLibFile) 
  4195.  
  4196. Parameters: 
  4197.  
  4198.  FuncCount (ULONG) - input 
  4199.     Number of REXX procedures to load from the saved macrospace. 
  4200.  
  4201.  FuncNames (PSZ *) - input 
  4202.     Address of a list of ASCIIZ REXX function names. FuncCount gives the size 
  4203.     of the function list. 
  4204.  
  4205.  MacroLibFile (PSZ) - input 
  4206.     Address of the ASCIIZ saved macrospace file name. 
  4207.  
  4208.  
  4209. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4210.  
  4211. RexxLoadMacroSpace returns the following values: 
  4212.  
  4213.  0         RXMACRO_OK 
  4214.  1         RXMACRO_NO_STORAGE 
  4215.  2         RXMACRO_NOT_FOUND 
  4216.  4         RXMACRO_ALREADY_EXISTS 
  4217.  5         RXMACRO_FILE_ERROR 
  4218.  6         RXMACRO_SIGNATURE_ERROR 
  4219.  
  4220.  
  4221. ΓòÉΓòÉΓòÉ <hidden> Notes - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4222.  
  4223. When FuncCount is 0 or FuncNames is NULL, RexxLoadMacroSpace loads all REXX 
  4224. procedures from the saved file. 
  4225.  
  4226. If the RexxLoadMacroSpace function must replace an existing macrospace REXX 
  4227. procedure, the entire load request is discarded and the macrospace remains 
  4228. unchanged. 
  4229.  
  4230.  
  4231. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxLoadMacroSpace ΓòÉΓòÉΓòÉ
  4232.  
  4233. The following functions are related to RexxLoadMacroSpace: 
  4234.  
  4235.       RexxAddMacro 
  4236.       RexxDropMacro 
  4237.       RexxClearMacroSpace 
  4238.       RexxSaveMacroSpace 
  4239.       RexxQueryMacro 
  4240.       RexxReorderMacro 
  4241.  
  4242.  
  4243. ΓòÉΓòÉΓòÉ 18.6. RexxQueryMacro ΓòÉΓòÉΓòÉ
  4244.  
  4245.  
  4246. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  4247.  
  4248. Topics: 
  4249.  
  4250.       Call Syntax 
  4251.       Uses 
  4252.       Parameters 
  4253.       Return Values 
  4254.       Errors 
  4255.       Related Functions 
  4256.       Examples 
  4257.  
  4258.  
  4259. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxQueryMacro ΓòÉΓòÉΓòÉ
  4260.  
  4261. /*******************************************/
  4262. /* RexxQueryMacro searches the            */
  4263. /*  macrospace for a specified function.   */
  4264. /*******************************************/
  4265.  
  4266. #define INCL_RXMACRO    /* Macrospace values */
  4267.  
  4268. PSZ     name;       /* function name         */
  4269. USHORT  position;   /* search order position */
  4270. ULONG   rc;         /* Return code           */
  4271.  
  4272. rc = RexxQueryMacro(name, &position);
  4273.  
  4274.  
  4275. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxQueryMacro ΓòÉΓòÉΓòÉ
  4276.  
  4277. RexxQueryMacro searches the macrospace for a specified function. 
  4278.  
  4279.  
  4280. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxQueryMacro ΓòÉΓòÉΓòÉ
  4281.  
  4282. RexxQueryMacro (FuncName, Position) 
  4283.  
  4284. Parameters: 
  4285.  
  4286.  FuncName (PSZ) - input 
  4287.     Address of an ASCIIZ function name. 
  4288.  
  4289.  Position (PUSHORT) - output 
  4290.     Address of an unsigned short integer flag. If the function is loaded in the 
  4291.     macrospace, Position is set to the current function search-order position. 
  4292.  
  4293.  
  4294. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxQueryMacro ΓòÉΓòÉΓòÉ
  4295.  
  4296. RexxQueryMacro returns the following values: 
  4297.  
  4298.  0         RXMACRO_OK 
  4299.  2         RXMACRO_NOT_FOUND 
  4300.  
  4301.  
  4302. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxQueryMacro ΓòÉΓòÉΓòÉ
  4303.  
  4304. The following functions are related to RexxQueryMacro: 
  4305.  
  4306.       RexxAddMacro 
  4307.       RexxDropMacro 
  4308.       RexxClearMacroSpace 
  4309.       RexxSaveMacroSpace 
  4310.       RexxLoadMacroSpace 
  4311.       RexxReorderMacro 
  4312.  
  4313.  
  4314. ΓòÉΓòÉΓòÉ 18.7. RexxReorderMacro ΓòÉΓòÉΓòÉ
  4315.  
  4316.  
  4317. ΓòÉΓòÉΓòÉ <hidden> Instructions ΓòÉΓòÉΓòÉ
  4318.  
  4319. Topics: 
  4320.  
  4321.       Call Syntax 
  4322.       Uses 
  4323.       Parameters 
  4324.       Return Values 
  4325.       Errors 
  4326.       Related Functions 
  4327.  
  4328.  
  4329. ΓòÉΓòÉΓòÉ <hidden> Call Syntax - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4330.  
  4331. /*******************************************/
  4332. /* RexxReorderMacro changes the search    */
  4333. /*  order position of a loaded macrospace  */
  4334. /*  function.                              */
  4335. /*******************************************/
  4336.  
  4337. #define INCL_RXMACRO    /* Macrospace values */
  4338.  
  4339. PSZ     name;       /* function name         */
  4340. ULONG   rc;         /* Return code           */
  4341.  
  4342. rc = RexxReorderMacro(name, RXMACRO_SEARCH_AFTER);
  4343.  
  4344.  
  4345. ΓòÉΓòÉΓòÉ <hidden> Uses - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4346.  
  4347. RexxReorderMacro changes the search order position of a loaded macrospace 
  4348. function. 
  4349.  
  4350.  
  4351. ΓòÉΓòÉΓòÉ <hidden> Parameters - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4352.  
  4353. RexxReorderMacro (FuncName, Position) 
  4354.  
  4355. Parameters: 
  4356.  
  4357.  FuncName (PSZ) - input 
  4358.     Address of an ASCIIZ macrospace function name. 
  4359.  
  4360.  Position (ULONG) - input 
  4361.  
  4362.     New search-order position of the macrospace function. Possible values are: 
  4363.  
  4364.     RXMACRO_SEARCH_BEFORE 
  4365.             The function will be located by the REXX interpreter before any 
  4366.             registered functions or external REXX files. 
  4367.  
  4368.     RXMACRO_SEARCH_AFTER 
  4369.             The function will be located by the REXX interpreter after any 
  4370.             registered functions or external REXX files. 
  4371.  
  4372.  
  4373. ΓòÉΓòÉΓòÉ <hidden> Return Values - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4374.  
  4375. RexxReorderMacro returns the following values: 
  4376.  
  4377.  0         RXMACRO_OK 
  4378.  2         RXMACRO_NOT_FOUND 
  4379.  8         RXMACRO_INVALID_POSITION 
  4380.  
  4381.  
  4382. ΓòÉΓòÉΓòÉ <hidden> Related Functions - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4383.  
  4384. The following functions are related to RexxReorderMacro: 
  4385.  
  4386.       RexxAddMacro 
  4387.       RexxDropMacro 
  4388.       RexxClearMacroSpace 
  4389.       RexxSaveMacroSpace 
  4390.       RexxLoadMacroSpace 
  4391.       RexxQueryMacro 
  4392.  
  4393.  
  4394. ΓòÉΓòÉΓòÉ <hidden> Macrospace Interface Errors ΓòÉΓòÉΓòÉ
  4395.  
  4396. The follow return codes can be returned from the macrospace functions.  These 
  4397. values signify the causes for a failure, in these functions. 
  4398.  
  4399.  RXMACRO_OK 
  4400.     The function completed successfully 
  4401.  
  4402.  RXMACRO_NO_STORAGE 
  4403.     There was not enough memory to complete the requested function. 
  4404.  
  4405.  RXMACRO_NOT_FOUND 
  4406.     The requested procedure was not found in the macrospace. 
  4407.  
  4408.  RXMACRO_EXTENSION_REQUIRED 
  4409.     An extension is required for the macrospace file name. 
  4410.  
  4411.  RXMACRO_ALREADY_EXISTS 
  4412.     Duplicate functions cannot be loaded from a macrospace file. 
  4413.  
  4414.  RXMACRO_FILE_ERROR 
  4415.     An error occurred accessing a macro space file. 
  4416.  
  4417.  RXMACRO_SIGNATURE_ERROR 
  4418.     A macrospace save file does not contain valid function images. 
  4419.  
  4420.  RXMACRO_SOURCE_NOT_FOUND 
  4421.     The requested file was not found. 
  4422.  
  4423.  RXMACRO_INVALID_POSITION 
  4424.     An invalid search-order position request flag was used. 
  4425.  
  4426.  
  4427. ΓòÉΓòÉΓòÉ <hidden> Examples - RexxReorderMacro ΓòÉΓòÉΓòÉ
  4428.  
  4429. The following example shows the use of RexxAddMacro, RexxQueryMacro, 
  4430. RexxLoadMacroSpace, and RexxSaveMacroSpace. 
  4431.  
  4432.                                        /* first load entire package  */
  4433.   RexxLoadMacroSpace(0, NULL, "EDITOR.MAC");
  4434.  
  4435.   for (i = 0; i < MACRO_COUNT; i++) {  /* verify each macro          */
  4436.                                        /* if not there               */
  4437.     if (RexxQueryMacro(macro[i], &position))
  4438.                                        /* add to list                */
  4439.       RexxAddMacro(macro[i], macro_files[i],
  4440.           RXMACRO_SEARCH_BEFORE);
  4441.   }
  4442.                                        /* rebuild the macrospace     */
  4443.   RexxSaveMacroSpace(0, NULL, "EDITOR.MAC");
  4444.  
  4445. .
  4446. .
  4447. .
  4448.  
  4449.                                        /* build the argument string  */
  4450.   MAKERXSTRING(argv[0], macro_argument,
  4451.       strlen(macro_argument));
  4452.                                        /* set up default return      */
  4453.   MAKERXSTRING(retstr, return_buffer, sizeof(return_buffer));
  4454.                                        /* set up for macrospace call */
  4455.   MAKERXSTRING(macrospace[0],NULL, 0);
  4456.   MAKERXSTRING(macrospace[1],NULL, 0);
  4457.  
  4458.   return_code = RexxStart(1,           /* one argument               */
  4459.                           argv,        /* argument array             */
  4460.                           macro[pos],  /* REXX procedure name        */
  4461.                           macrospace,  /* use macrospace version     */
  4462.                           "Editor",    /* default address name       */
  4463.                           RXCOMMAND,   /* calling as a subcommand    */
  4464.                           NULL,        /* no exits used              */
  4465.                           &rc,         /* converted return code      */
  4466.                           &retstr);    /* returned result            */
  4467.