home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / docs / rexxapi.inf (.txt) < prev    next >
Encoding:
OS/2 Help File  |  1993-07-30  |  110.4 KB  |  4,345 lines

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