home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mumps / mpkerdoc.txt < prev   
Text File  |  2020-01-01  |  19KB  |  392 lines

  1. MUMPS Kermit
  2.  
  3. Kermit-M is written in the 1982 ANSI Standard MUMPS language.  MUMPS is
  4. typically used for transaction-oriented data base applications.  There are two
  5. types of MUMPS implementations, those running under some host operating system
  6. (e.g. CP/M, VMS, Unix), and those with their own integrated operating system.
  7. In the former type, it is probably faster to use a Kermit developed for the
  8. host operating system, and then use local utility programs to transfer between
  9. the host operating system and MUMPS data structures.  Kermit-M was developed
  10. on M/11, which has its own integrated operating system.  In this case, Kermit
  11. must be written in the MUMPS language (since that's the only language
  12. available on such systems), and Kermit must be able to understand MUMPS data
  13. structures.  Since MUMPS was never intended to be a systems programming
  14. language, there are certain performance penalties in using Kermit-M.
  15.  
  16. Kermit-M is divided into two main sections.  The first provides most of the
  17. functions of other Kermits, including Server mode.  There is no 8-bit quoting,
  18. so that only the 7-bit ASCII character set is supported.  In this section, he
  19. command parser follows TOPS-20 style, with extensive HELP.  The second
  20. provides the interface between the Kermit file structure and MUMPS data
  21. structures.  This is accessed with the MUMPS command, and is organized as a
  22. series of menus, in the more usual MUMPS interactive style.  Since MUMPS
  23. systems do not have typical (e.g. TOPS-20 style) file systems, Kermit-M must
  24. simulate a file system within MUMPS data structures, and the MUMPS command
  25. must provide typical file system services (Directory of files; Copy, Rename,
  26. and Erase files).  The MUMPS command also provides the mechanism for
  27. interpreting Kermit files as MUMPS data structures, and vice-versa.  The MUMPS
  28. data structures that are supported are 1) routines, 2) globals, 3) sequential
  29. 'files' (e.g. magtape, sequential disk processor, terminals), and 4) globals
  30. interpreted as sequential files.
  31.  
  32. Although MUMPS is an ANSI standard language, certain sections of the language
  33. which are critical to Kermit-M are implementation-specific.  Almost everything
  34. dealing with I/O is in this category.  The initial version of Kermit-M was
  35. developed at the New York State College of Veterinary Medicine, on a PDP-11/44
  36. running InterSystems' M/11, Version 5.  It will have to be modifed for any
  37. other MUMPS implementation.  A separate document has been prepared for those
  38. who need to prepare a new version.
  39.  
  40. Installation of Kermit-M
  41.  
  42. Kermit-M consists of about 20 MUMPS routines (all starting with the prefix
  43. ZKR) which are about 2 to 4 KB of text), and one reference global (^ZKRX)
  44. which is about 40KB.
  45.  
  46. The routines, reference file, and external comments are provided in two ways:
  47. as 3 files on 800BPI 9 track magnetic tape (separated by tape marks) , and as
  48. TOPS-20 files named, respectively, 'KERMITM.ROU', 'KERMITM.GLO', and
  49. 'KERMITM.ECM'.  [Editors note:  These have been renamed to MPKERMIT.ROU,
  50. MPKERMIT.GLO, and .ECM, respectively, for distribution purposes.]
  51.  
  52. The first file contains the text of all routines.  The first line is a string
  53. of MUMPS code that allows the rest of the file to be loaded according to the
  54. proposed MDC standard on interchange of routines.  (This code is 'R DATE F
  55. I=0:0 R ROU Q:ROU=""  ZL  ZS @ROU'.) The second line is the date and time the
  56. file was written.  Following these two header lines are the routine texts.
  57. Each routine begins with one line containing just its name, and ends with a
  58. null line.  The file ends with an additional null line.  If the file can be
  59. opened as a sequential device, all the routines can be loaded into the MUMPS
  60. routine space by entering the following MUMPS code: 'R X X X'.
  61.  
  62. The second file contains the reference file, ^ZKRX.  The first line is a
  63. string of MUMPS code that allows the rest of the file to be loaded according
  64. to the proposed MDC standard on interchange of globals.  (This code is 'R DATE
  65. F I=0:0 R GREF Q:GREF=""  R DATA S @GREF=DATA'.).  The second line is the date
  66. and time the file was written.  Follwing this are pairs of lines, the first of
  67. each pair being the global reference, and the second being the data to be
  68. stored at that reference.  The file ends with a null line in place of a global
  69. reference.  If the file can be opened as a sequential device, the global can
  70. be loaded into the MUMPS data space by entering the following MUMPS code: 'R X
  71. X X'.
  72.  
  73. The third file contains 'external' comments.  These are additional comments,
  74. too lengthy to fit in the routine text, which are stored in global ^COMMENT.
  75. The first two subscripts in ^COMMENT are the routine name and the label to
  76. which the comment applies.  The third subscript is always '0', and the fourth
  77. level contains text lines, at subscripts 1 by 1.  This file is organized and
  78. loaded exactly as the second file (reference global).
  79.  
  80. Once the routines and reference global are loaded, it may be necessary to make
  81. certain system-dependent changes.  See the document 'Adapting Kermit-M to
  82. different implementations of MUMPS'.  On InterSystems M/11 Version 5 systems,
  83. either a) Kermit-M must be loaded into the 'manager' UCI, or b) routine ZKRTC
  84. must be moved to the 'manager' UCI and renamed to %ZKRTC, and the two calls to
  85. this routine (TTYON+1^ZKR and ZKRC+5^ZKRC) must be edited accordingly.
  86.  
  87.  
  88.                New York State College of Veterinary Medicine
  89.                         Veterinary Computing Facility
  90.                             Kermit-M User's Guide
  91.  
  92. Introduction
  93.  
  94. Kermit is a program that transfers information between different computer
  95. systems.  The original Kermit was written for the TOPS20 operating system.
  96. Since then, Kermits have been developed for Unix, VMS, CMS, RT-11, CP/M,
  97. MS-DOS, and Apple DOS.  These operating systems run on a wide variety of
  98. computers, from micros (Apple II, DEC Rainbow, IBM PC) thru minis (PDP-11,
  99. VAX-11) to mainframes (IBM 370, DECSYSTEM-20).  Kermit-M is a version of
  100. Kermit that is written in MUMPS.  The original version is designed for PDP-11
  101. computers running InterSystem's M/11 operating system (version 5).
  102.  
  103. All Kermits communicate with each other.  Thus with the development of
  104. Kermit-M, it is now possible to transfer routines, globals, and sequential
  105. files between our M/11 systems and many other computer systems.  For example,
  106. you could develop programs in standard MUMPS on an M/11 system, and then
  107. download them to a micro-MUMPS system.  Or, you could create data files from
  108. searches on M/11, and transfer them to a mainframe system or VMS) for
  109. statistical analysis.
  110.  
  111. Limitations
  112.  
  113. Kermit can achieve a thruput of about 50 characters per second, which is about
  114. 6.5 hours per megabyte; in 20 minutes Kermit could transfer about 50 disk
  115. blocks.  Clearly, this speed is only acceptable for transferring MUMPS
  116. routines or small data files.
  117.  
  118. Over a 9600 bps direct connection, Kermit is about 3 times as fast as over a
  119. 1200 bps phone line, i.e. about 150 cps.  This speed is still not acceptable
  120. for large data files.
  121.  
  122. Industry-standard magnetic tape (9 track, 1/2 inch) is the best method of
  123. transferring large quantities of data between systems.
  124.  
  125. System load due to Kermit-M
  126.  
  127. Kermit-M on the NYSCVM MUMPS system is a fairly intensive user of both the
  128. processor and the disk or during file transfer to or from other systems, or
  129. while Kermit-M files are being transferred to or from MUMPS data structures.
  130. Programmers should avoid using Kermit-M during times of heavy system use.
  131.  
  132. Using Kermit-M -- an overview
  133.  
  134. To SEND files to another computer, the basic steps are:
  135.  
  136.      1. transfer from MUMPS data structures (e.g. routines) to the
  137.         Kermit-M file system (see below).
  138.  
  139.      2. connect to the other computer
  140.  
  141.      3. Issue the SEND command at the Kermit-M end, and the RECEIVE
  142.         command at the other end
  143.  
  144.      4. break the connection (may involve logging off the other system)
  145.  
  146. To RECEIVE files from another computer:
  147.  
  148.      1. connect to the other computer
  149.  
  150.      2. Issue the RECEIVE command at the Kermit-M end, and the SEND
  151.         command at the other end
  152.  
  153.      3. break the connection
  154.  
  155.      4. transfer from the Kermit-M file system to MUMPS data structures.
  156.  
  157. Some detailed examples of sessions are given at the end of this document.
  158.  
  159. The Kermit-M file system
  160.  
  161. The file system is a familiar concept to microcomputer and traditional
  162. time-sharing system users, but not to most MUMPS programmers.  Basically, the
  163. data accessible to the program is a set of sequential (line-by-line) files.
  164. These may represent globals, routines, or MUMPS sequential files, but they are
  165. all stored as a list of lines, separated by <CR><LF>.  Each file has a unique
  166. name, which is separated into two parts:
  167.  
  168.      filename.filetype
  169.  
  170.      for example, ZKR.ROU
  171.  
  172. The filename names the information, and the filetype gives some indication of
  173. what kind of data is in the file.  Common filetypes are:
  174.  
  175.      .ROU  -- a set of MUMPS routines, in %RO/%RI format
  176.      .MMP  -- one micro-MUMPS routine
  177.      .GLO  -- global references and data, in %GO/%GI format
  178.      .TXT  -- text
  179.  
  180. The filename usually represents the MUMPS data structure in some way.  For
  181. example, file ZKR.ROU might be a set of routines from program ZKR, and file
  182. ZKRX.GLO might be ^ZKRX.
  183.  
  184. There are file system commands for managing files: ERASE to delete unwanted
  185. files, COPY to make another copy of a file, RENAME to change a file name, and
  186. DIRECTORY to see what files are in the file system.  As you work in the file
  187. system, you are often asked to specify a file or set of files.  You may enter
  188. an exact file name, or you can use 'wild cards' in either or both of the
  189. filename and filetype.  The 'wild card' is an asterisk (*) character, which
  190. indicates that any (or no) completion of the field is acceptable.  For
  191. example,
  192.  
  193.      Z*.ROU    would include all files of filetype 'ROU', and
  194.                 with the initial letter of the filename as 'Z'.
  195.      *.GLO     would include all files with filetype 'GLO'
  196.      Z*.*      would include all files with the initial letter of
  197.                 the filename as 'Z'
  198.      *.*       would include all files in the file system
  199.  
  200. In this way you can deal with logical groups of files with one command,
  201. instead of typing each exact file name.
  202.  
  203. Communicating between MUMPS and the Kermit-M file system
  204.  
  205. Since Kermit-M files are what Kermit actually sends and receives, we need some
  206. way to get information in these files to and from MUMPS data structures,
  207. namely, routines, globals, and sequential files.  This is accomplished by the
  208. INPUT and OUTPUT options within the MUMPS command of Kermit-M.
  209.  
  210. Accessing Kermit-M
  211.  
  212. There is a separate copy of Kermit-M, including data files, in each UCI in
  213. which it resides.  Currently, these are : MGR on both systems, ETA (A) and ETB
  214. (B).  There is a copy in TSA (A); however, this may be a different version
  215. than the others (as TSA is the test location).  You must get the data you wish
  216. to transfer to or from one of these UCI's, preferably, ETA or ETB.
  217.  
  218. Call Kermit-M by signing into a UCI in direct (programmer) mode and:
  219.  
  220.      >D ^ZKR
  221.  
  222. When you see the prompt:
  223.  
  224.      Kermit-M>
  225.  
  226. you are at the command level.  Enter commands using TOPS-20 style (this is for
  227. consistency with other Kermits), which is considerably different that the
  228. usual MUMPS style.  You can enter entire commands, ending with <CR>.  Or, you
  229. can enter the command in parts, ending each section with <ESC>; Kermit-M will
  230. complete as much of the command as it can and prompt you for more.  You can
  231. enter '?' at any point in the command to see possible completions.
  232.  
  233. One of the commands is MUMPS.  This invokes the Kermit-to-MUMPS interface
  234. subprogram, which is organized as a series of menus in conventional MUMPS
  235. interactive style.  (This command is not necessary or available in other
  236. Kermits.)  Here is an overview of the functions and commands in Kermit-M:
  237.  
  238. Kermit-M>
  239.  
  240.     EXIT or QUIT   -- leave Kermit
  241.     HELP           -- information
  242.     SEND           -- send files to another machine
  243.     RECEIVE        -- receive files from another machine
  244.     SERVER         -- take all commands from another machine, e.g.
  245.                        to send or receive files
  246.     GET,FINISH,BYE -- commands for a remote Kermit server
  247.     SET            -- set up to communicate with other systems
  248.     CONNECT        -- connect to another machine
  249.     SHOW           -- show the current values of SET parameters
  250.     STATISTICS     -- statistics about the most recent transfer
  251.     MUMPS          -- enter the Kermit-M file system and the
  252.                        Kermit-M <--> MUMPS transfer options
  253.  
  254. within the MUMPS command:
  255.  
  256.  DIRECTORY of Kermit-M files
  257.  COPY         Kermit-M files
  258.  RENAME       Kermit-M files
  259.  ERASE        Kermit-M files
  260.  
  261.  INPUT options (Kermit-M files --> MUMPS data structures)
  262.    1. sequential file in (e.g. print, write to tape or SDP)
  263.    2. routine input (micro-MUMPS routines)
  264.    3. routine input (like %RI)
  265.    4. global input (like %GI)
  266.    5. sequential global input
  267.  
  268.  OUTPUT options (MUMPS data structures --> Kermit-M files)
  269.    -- inverse of choices 1 to 5 of INPUT options
  270.  
  271.                Adapting Kermit-M to different implementations of MUMPS
  272.  
  273.  
  274.  
  275. Introduction
  276.       Kermit-M is an implementation of the KERMIT file transfer program written
  277. in 1982 ANSI Standard MUMPS.  It uses most of the new language features in the
  278. 1982 Standard, including SET $PIECE, subscript indirection, two-argument
  279. $PIECE, $EXTRACT, and $ LENGTH, extended pattern matching, and fixed-length
  280. READ.  It would be a tedious job to translate to the 1977 Standard or
  281. non-standard versions of MUMPS.  Even within the 1982 Standard, there are many
  282. implementations, all of which differ in some important ways for the Kermit
  283. implementor.  This document explains how to adapt the Kermit-M implementation
  284. for your specific MUMPS.
  285.  
  286. Limitations on terminal I/O for all versions
  287.       Your MUMPS must implement the single-character READ and WRITE commands to
  288. terminal lines as follows:
  289.  
  290.      READ *A  -- 'A' must be returned as the decimal value of the ASCII
  291.                  character read, e.g. CTRL/C is returned as 3.
  292.                  All 128 7-bit codes (0-127) must be readable.
  293.  
  294.      WRITE *A  -- 'A' must be the decimal ASCII value of the character
  295.                   to be written (inverse of READ *).
  296.  The MUMPS standard does not state what values are returned by a READ *, nor
  297. what values are expected by a WRITE *.
  298.       In addition, your MUMPS must support the fixed-length READ (which is
  299. standard):
  300.  
  301.      READ A#COUNT  -- read COUNT characters into variable A as
  302.                       text; no explicit terminator of the READ
  303.                       is necessary.
  304.  
  305. Finding implementation-specific code
  306.       All code that depends on the implementation of MUMPS should be commented
  307. at the end of each such line with the comment:
  308.  
  309.      ;** version
  310.  
  311. where 'version' is a mnemonic for the MUMPS implementation, e.g.  'M/11 V5'
  312. for InterSystems M/11, version 5.  There is always at least one other version
  313. of the same code, immediately following any 'version' code, which is commented
  314. as:
  315.  
  316.      ;** STD
  317.  
  318. This means that this code will run on any MUMPS implementation.  Note that it
  319. might not do anything useful.  For example, to open a communications port
  320. without echo, the code might be: we might have something like:
  321.  
  322.      O TTY:("":"S") ;** M/11 V5
  323.      ;open port TTY without echo ;** STD
  324.  
  325. In this case, there is no standard way to turn off echo on a port, so we just
  326. you must write your own.
  327.  
  328. Altering the code for your version
  329.  
  330. The code for all implementations except the one you're actually running is
  331. commented out at the beginning of each such line.  So, locate all lines
  332. including the ;** construct, comment out our lines, and remove the comments
  333. from the lines for your version.  In some cases, you'll have to write detailed
  334. code.
  335.  
  336. Other variations in I/O
  337.  
  338. 1) Input and output buffer size
  339.  
  340. When running at high input speeds, incoming packets must be limited to no
  341. longer than the length of the system's input buffer.  For example, in M/11 V5,
  342. the default input buffer length for terminal lines is 64 characters; this is
  343. the maximum packet length at high speeds (at 1200 Baud, the program usually
  344. empties enough of the buffer to allow maximum length, i.e. 94, packets).  The
  345. Kermit protocol does not specify any flow control mechanism (e.g. XON/XOFF),
  346. so there is no way for MUMPS to inform the other Kermit that the input buffer
  347. is about to overflow, which is how this problem is usually solved in ordinary
  348. terminal I/O.  You can use the SET RECEIVE PACKET-LENGTH command to do this;
  349. for a more permanent fix, alter the code in INITPAR^ZKRUM which sets the
  350. initial value of RPSIZ.
  351.  
  352. The size of the output buffer is not usually a problem, since most operating
  353. systems will suspend a program that tries to do output to a full output
  354. buffer, until there is room in the buffer.  If not, use the SET SEND
  355. PACKET-LENGTH command to set the default output packet size.  Note however
  356. that the other Kermit can request a different maximum; you might have to use
  357. SET RECEIVE PACKET-LENGTH on the other Kermit.
  358.  
  359. 2) Image mode and terminators
  360.  
  361. You must ensure that the SOH character is passed thru the operating system to
  362. Kermit.  The default SOH is CTRL/A (ASCII 1); if there is a problem with this,
  363. the user can SET RECEIVE START-OF-PACKET and SET SEND START-OF-PACKET as
  364. necessary; or for a more permanent fix, the code in INITPAR^ZKRUM can be
  365. altered.
  366.  
  367. SOH is the usually the only non-printing character sent or received by Kermit.
  368. However, if the other end needs padding (which it will request in its
  369. Send-init packet or its acknowledgement to Kermit-M's Send-init), we must be
  370. able to transmit it thru the operating system.
  371.  
  372. Setting line parameters
  373. Kermit-M provides several SET options that must be implemented in a
  374. system-specific manner.  These include SET PARITY, SET BAUD, and SET DUPLEX.
  375. Also, local echo is enabled and disabled in a system-specific manner, and the
  376. OPEN, CLOSE, and USE commands are implementation-specific.
  377.  
  378. In some systems, it may not be possible to change parity or baud from within
  379. MUMPS; these options should be removed, either by changing ^ZKRX("COMMAND"...)
  380. or giving messages like 'can't do that on this system' when trying to execute
  381. the command in routine ZKRSET.
  382.  
  383. In M/11 V5, the parity, 8-bit data, and baud can only be set by a program
  384. running in the system manager's UCI.  Routine ZKRTC, which provides these
  385. functions , must reside in this UCI (along with the rest of Kermit).
  386. Alternatively, if Kermit is to reside in another UCI, routine ZKRTC must be
  387. moved to the system manager's UCI and renamed %ZKRTC, and the calls to ZKRTC
  388. (at TTYON+1^ZKR and ZKRC+5^ZKRC) must be modified to call %ZKRTC.  You will
  389. have to write an analogous routine for other systems.  In MUMPS running under
  390. other operating systems, you can probably perform these functions with system
  391. calls.
  392.