home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc190.zip / ckorexx.doc < prev    next >
Text File  |  1994-06-19  |  4KB  |  113 lines

  1. OS/2 C-KERMIT'S REXX INTERFACE EXPLAINED
  2.  
  3.   Jeffrey Altman, Altmania Productions and Seer Technologies
  4.   <p00118@psilink.com>
  5.   February 8, 1994
  6.   Updated 23 Apr 94 (See the end of this file for info about VX-REXX)
  7.   And 1 Jun 94 (CKCOMMAND and REXXFILE commands removed)
  8.  
  9. Why would you want to use Rexx from within C-Kermit?
  10.  
  11. *  Easier to use math functions
  12. *  Want to run a Rexx program but don't want the overhead of starting a 
  13.     command shell
  14. *  Want to have access to additional OS/2 specific functionality (i.e. 
  15.         Create WPS objects, perform directory searchs, ...)
  16. *  Want to add your own functions to the C-Kermit script language
  17.  
  18. There are three types of functionality provided in the C-Kermit/Rexx interface:
  19.  
  20. *  ability to execute a Rexx command line
  21. *  ability to execute a Rexx command file
  22. *  ability to call C-Kermit commands from a Rexx program (while 
  23.     executing under C-Kermit)
  24.  
  25. --------------------
  26.  
  27. Let's say you want to execute a one-line Rexx program from within 
  28. C-Kermit.  You would use the new C-Kermit "rexx" command.  The format 
  29. of the command is:
  30.  
  31.     rexx <rexx command>
  32.  
  33. where <rexx command> is everything after the keyword "rexx" to the end 
  34. of the line.  A simple example:
  35.  
  36.     rexx say "hello" 
  37.  
  38. will execute the rexx command SAY with the parameter "hello".  "hello" 
  39. will now be printed on your screen.
  40.  
  41. Another example, returning a value from rexx.
  42.  
  43.     rexx return 4 * 4
  44.  
  45. the rexx command "return 4 * 4" will calculate the value "16" and then 
  46. return it to C-Kermit.  C-Kermit stores the return value from the last 
  47. Rexx command in \v(rexx).
  48.  
  49. Let's say you want to execute a series of rexx commands, but don't want 
  50. to create a file.
  51.  
  52.     rexx say "hello"\13 return 0
  53.  
  54. This will print the string "hello" and then return the value "0" to 
  55. C-Kermit.  Notice that \13 (^M) was placed between the commands.  This 
  56. is necessary because rexx expects to find each command separated by a 
  57. return character just as if it was being read from a file.
  58.  
  59. ---------------------
  60.  
  61. To execute a REXX command file, use:
  62.  
  63.   C-Kermit> rexx call oofa.cmd
  64.  
  65. (where "oofa.cmd" is the name of your REXX command file).
  66.  
  67. ---------------------
  68.  
  69. Now let's say that you have this really great Rexx program, and you want 
  70. to be able to gain access to a C-Kermit variable value, change a 
  71. C-Kermit setting, or execute a C-Kermit command.  You could alter your 
  72. program so that it is called in separate parts from a C-Kermit take 
  73. file or macro.  But we have a better way.  Just include the C-Kermit 
  74. command in your Rexx program.
  75.  
  76. For instance, you want to set the parity from within your Rexx program:
  77.  
  78.     /* beginning of rexx program file */
  79.     parity = "None"
  80.     set parity parity
  81.  
  82. will result in C-Kermit setting the parity to "None"
  83.  
  84. Let's say we want to set a Rexx variable to that of a C-Kermit 
  85. variable.  Here is how we would do it:
  86.  
  87.     parity = '\v(parity)'
  88.  
  89. Notice the quotes around the C-Kermit statement.  This tells Rexx to pass
  90. the statement to C-Kermit for evaluation before performing the assignment.
  91.  
  92. --------------------
  93.  
  94. Q: What happens if you create a Rexx program file that contains C-Kermit
  95.    commands and you try to execute it outside of the C-Kermit environment?
  96.  
  97. A: A Syntax Error.  
  98.  
  99. This is because the C-Kermit commands are only available when C-Kermit is 
  100. executing the Rexx command file.  
  101.  
  102. Q: Can C-Kermit be used with Rexx programming tools such as Watcom's 
  103.    VX-REXX?
  104.  
  105. A: Yes and No.  
  106.    C-Kermit and VX-REXX work together too.  To run a VX-REXX program from
  107.    within C-Kermit, first generate a .VRM file and then invoke it with the
  108.    C-Kermit REXX CALL command.  However, the VX-REXX program is not allowed 
  109.    to make Presentation Manager calls, because VIO applications (like C-Kermit)
  110.    can't do that.
  111.  
  112. (End of CKOREXX.DOC)
  113.