home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dmetd4fp.zip / COMETMP.DOC < prev    next >
Text File  |  1991-02-06  |  75KB  |  3,037 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.          **** DEMO Copy *** DEMO Copy *** DEMO Copy *** DEMO Copy ****
  8.          *                                                           *
  9.          *        COMET-MP: the Background Communications Library    *
  10.          *                                                           *
  11.          *       by CompuSolve  88 Erie Ave  Rockaway, NJ 07866      *
  12.          *                       (201)983-9429                       *
  13.          *************************************************************
  14.  
  15.           This manual and associated software for COMET-MP is provided as
  16.          a demonstration/evaluation copy.  It's only limitation is
  17.          that file transfers are limited to 2k (2048 bytes) in size.
  18.          Any file transfer commands encountering a file size that
  19.          exceeds this 2k demo limit will automatically cancel.
  20.  
  21.          Once you're impressed with COMET's abilities you can order
  22.          it directly from CompuSolve by phone (VISA-MC-AMEX) or
  23.          send a check for $169 to receive the latest copy of the
  24.          product and a manual.  Of course we'll remove the 2k limit
  25.          for those of you that order!  COMET is sold ROYALTY FREE so
  26.          the necessary COMET.BIN or linked COMET.OBJ can be included
  27.          with all your applications at no additional cost.
  28.  
  29.         There are two versions of COMET available, a single port version
  30.         called COMET and the multi-port version called COMET-MP which can
  31.         support up to 5 COM ports simultaneously, all in the BACKGROUND.
  32.         This demo package contains the COMET-MP version.  The single port
  33.         version sells for $99.00 .
  34.  
  35.  
  36.         This manual has been generated with 66 lines/page.
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                                    C O M E T - M P
  77.  
  78.  
  79.  
  80.                        Copyright (c) 1989 - 1991 by CompuSolve
  81.                                  All Rights Reserved
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.                                      CompuSolve
  122.                                    88 Erie Avenue
  123.                                  Rockaway, NJ 07866
  124.                                        U.S.A.
  125.  
  126.          Tele: (201)983-9429
  127.          Support: (201)983-9429
  128.          BBS: (201)983-9426
  129.          FAX: (201)627-1028
  130.  
  131.                                                                    rev 1.0
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.          Table Of Contents
  140.  
  141.          Warranty .......................................  1
  142.          License ........................................  2
  143.          Technical Support ..............................  3
  144.          Installation ...................................  4
  145.          Introduction ...................................  5
  146.          Getting Started ................................  6
  147.          Conventions ....................................  7-8
  148.          Commands - General .............................  9
  149.          Commands:
  150.            ARECV ........................................ 10
  151.            ARECVA ....................................... 10
  152.            ASEND ........................................ 11
  153.            BUFFER ....................................... 12,13
  154.            CLOSE ........................................ 14
  155.            DTR .......................................... 15
  156.            FCHK ......................................... 16,17
  157.            FIND ......................................... 18
  158.            FINDI ........................................ 18
  159.            FLAVOR ....................................... 19
  160.            FLUSH ........................................ 20
  161.            INPUT ........................................ 21,22
  162.            MSTAT ........................................ 23
  163.            ONDCD ........................................ 24,25
  164.            ONDONE ....................................... 26
  165.            ONTIME ....................................... 27
  166.            OPEN ......................................... 28,29
  167.            OUTPUT ....................................... 30
  168.            RTS .......................................... 31
  169.            RXCNT ........................................ 32
  170.            STAT ......................................... 33
  171.            TXCNT ........................................ 34
  172.            VERS ......................................... 35
  173.            XRECV ........................................ 36
  174.            XSEND ........................................ 37
  175.            YRECV ........................................ 38
  176.            YSEND ........................................ 39
  177.          Troubleshooting ................................ 40
  178.          Error Codes .................................... 41
  179.          Appendix A (Auxilary-Byte Table) ............... 42
  180.          Appendix B (Clipper Event Trapping Notes) ...... 43
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.          WARRANTY
  200.  
  201.  
  202.          Thank you for purchasing the COMET communication library!
  203.  
  204.          CompuSolve offers a no nonsense money back guarantee to original
  205.          owner's of COMET.  You may return the entire software package
  206.          within the first 30 days of purchase for a full refund, for any
  207.          reason.  If you bought COMET directly from CompuSolve you'll need
  208.          to call and get a return authorization number before sending any
  209.          materials back.  If purchased from a mail order firm or elsewhere
  210.          you'll need to contact them directly for return information and
  211.          policies.
  212.  
  213.          While every effort has been made to make COMET reliable and bug
  214.          free, no software publisher can guarantee 100% bug free software.
  215.          CompuSolve will make every effort to investigate bug reports,
  216.          offer work around solutions and promptly offer software fixes at
  217.          no additional charge.
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                                         - 1 -
  265.          LICENSE
  266.  
  267.          Compusolve grants the original purchaser an unlimited duration
  268.          license to use COMET software under the following terms and
  269.          conditions:
  270.  
  271.  
  272.           1) When developing application software using the COMET software
  273.              library and associated manual, only one PC is to have COMET
  274.              installed at any given time.  Multiple copies of the COMET
  275.              libraries and documentation are prohibited.
  276.  
  277.  
  278.           2) After developing an application, you are entitled to provide
  279.              the COMET library file only along with the rest of your
  280.              application's programs.  For Clipper applications the
  281.              COMET.OBJ library file is directly linked in to produce
  282.              executable programs so no COMET files are to be distributed.
  283.              Interpretative dBASE languages should only have the COMET.BIN
  284.              library file distributed with the application programs.  In no
  285.              instance should the distributed COMET.BIN library file be
  286.              renamed.
  287.  
  288.  
  289.          Those not willing to agree to the above license terms should
  290.          return COMET within the first 30 days of purchase for a full
  291.          refund.
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.                                         - 2 -
  331.          TECHNICAL SUPPORT
  332.  
  333.  
  334.          Telephone:   (201)983-9429
  335.  
  336.          Phone support is free for the first 60 days to all registered
  337.          owners.  Beyond the first 60 days, there is a charge of $20 per
  338.          call or a yearly support plan costing $55 (Amex, MC and VISA)
  339.  
  340.  
  341.  
  342.  
  343.          Bulletin Board (BBS):  (201)983-9426
  344.  
  345.          Unlimited free technical support is available through the use of
  346.          our 24 hour a day bulletin board.  The board operates at 1200 or
  347.          2400 baud, 8 data bits, no parity and 1 stop bit (a perfect use
  348.          for the sample terminal emulation program that's included with
  349.          COMET).
  350.  
  351.          After logging on to the system, leave your questions or comments
  352.          as E-mail to the SYSOP.
  353.  
  354.  
  355.  
  356.  
  357.  
  358.          FAX:   (201)627-1028
  359.  
  360.          Also, unlimited free support is provided when inquiries are
  361.          directed to our FAX machine which is operative 24 hours a day.
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.                                         - 3 -
  397.          INSTALLATION
  398.  
  399.  
  400.          1) Insert the COMET product diskette into any floppy drive.
  401.  
  402.          2) Change to the hard disk directory where you want the COMET
  403.             files to be installed using DOS's  "CD" command.
  404.  
  405.          3) Assuming you've put the COMET diskette in drive A, run one of
  406.             the install programs listed below for your database language:
  407.  
  408.             A:CMETCLIP  - Clipper (all versions)
  409.                 or
  410.             A:CMETD3FX  - dBASEIII, FoxBase, QuickSilver and compatibles
  411.                 or
  412.             A:CMETD4FP  - dBASEIV AND FoxPro
  413.  
  414.  
  415.  
  416.          Example 1:
  417.  
  418.             C:
  419.             CD\CLIPPER
  420.             A:CMETCLIP
  421.  
  422.  
  423.  
  424.          Example 2:
  425.  
  426.             D:
  427.             CD\FOXPRO
  428.             A:CMETD4FP
  429.  
  430.  
  431.          Example 1 would install the Clipper version of COMET into the hard
  432.          disk's C:\DATABASE directory whereas example 2 would install the
  433.          dBASEIV/FoxPro version into D:\FOXPRO
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.                                         - 4 -
  463.          INTRODUCTION
  464.  
  465.  
  466.          COMET-MP is an add on communications library compatible with
  467.          dBASEIII/IV, FoxBase/Pro, Clipper S87/5.0, dBXL and QuickSilver.
  468.          COMET extends these database languages by adding powerful
  469.          communications capabilities.  One of COMET's most unique features
  470.          is that all of its commands operate entirely in the background
  471.          leaving your program free to do other tasks.  No longer do you
  472.          have to wait for lengthy file transfers to complete before being
  473.          returned to your database application.  Imagine a data entry
  474.          person posting invoices while COMET handles incoming modem calls
  475.          and performs file transfers, all in the background!
  476.  
  477.          COMET-MP (multi-port) supports the simultaneous use of
  478.          upto 5 COM ports.  With user defined I/O port addresses and
  479.          interrupts, COMET-MP will work on virtually any IBM PC compatible
  480.          RS232 hardware including boards manufactured by companies such as
  481.          DigiBoard and AST Research.
  482.  
  483.          This manual assumes the reader is somewhat familiar with serial
  484.          communications and its terminology (ie. baud rate, parity, COM
  485.          port etc.).  Those not familiar with such terms should refer to
  486.          appropriate books on the subject.  In addition, those intending to
  487.          do modem communications are well advised to obtain a copy of the
  488.          reference manual for their particular modem for an explanation of
  489.          modem configurations and command sets.
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.                                         - 5 -
  529.          Getting Started
  530.  
  531.          While COMET is primarily intended for use within a database
  532.          program, it will also work from the dot prompt of any of the
  533.          database languages with the exception of Clipper, as it is a
  534.          compiled language (Clipper developers: link COMET with Nantucket's
  535.          DOT.PRG to test from a dot prompt environment).
  536.  
  537.          In fact, using COMET from the dot prompt is one of the best ways
  538.          for programmers to familiarize themselves with COMET.  The
  539.          following few lines demonstrate how easy it is to OPEN a COM port
  540.          (COM1) with a Hayes compatible modem attached, then have the modem
  541.          dial a number:
  542.  
  543.          . LOAD COMETMP                          && Not needed for Clipper
  544.          . OpenCmd = 'OPEN COM1:2400,N,8,1,N'
  545.          . CALL COMETMP WITH OpenCmd
  546.          . Dial = 'OUTPUT #1,ATDT123-4567' + CHR(13)
  547.          . CALL COMETMP WITH Dial
  548.  
  549.          Now we'll CLOSE COM1 and force modem to disconnect:
  550.  
  551.          . ClsCmd = 'CLOSE #1'
  552.          . CALL COMETMP WITH ClsCmd
  553.  
  554.  
  555.          In addition to testing COMET from the dot prompt, you may want to
  556.          run and later examine the sample program TERMINAL.PRG which is a
  557.          simple terminal emulation program demonstrating many of COMET's
  558.          commands.
  559.  
  560.          NOTE: Clipper users will need to first compile and then link the
  561.          sample program as follows:
  562.  
  563.           a) CLIPPER TERMINAL.PRG     (compiles program)
  564.  
  565.           b) Using PLINK86 or RTLINK to link:
  566.  
  567.            =>FILE TERMINAL.OBJ, COMETMP.OBJ
  568.            =>OUTPUT TERMINAL.EXE
  569.            =>LIB CLIPPER, EXTEND
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.                                         - 6 -
  595.          COMMANDS - CALLING CONVENTIONS
  596.  
  597.  
  598.          The following section describes COMET's command set.  All of the
  599.          commands are invoked by using the CALL ... WITH command syntax
  600.          supported by each database language.
  601.  
  602.          The basic format of the CALL statement is:
  603.  
  604.          CALL COMETMP WITH <varC>
  605.  
  606.  
  607.          On Entry:
  608.  
  609.          <varC> is a character variable consisting of the following:
  610.  
  611.          1) The name of the COMET command to perform (required)
  612.          2) Port#(1-5) followed by a comma  (command dependent)
  613.          3) Command parameters/arguments (command dependent)
  614.  
  615.  
  616.  
  617.          On Return:
  618.  
  619.          In order to pass results or data back to the database program,
  620.          COMET modifies a portion of <varC>'s contents after performing the
  621.          requested command.  Using a database SUBSTR function, one can
  622.          extract the returned information from <varC>. This returned data
  623.          always starts immediately after the comma which seperates the port
  624.          # from the rest of the command parameters.
  625.  
  626.          NOTE: COMET will never increase the length of <varC> in order to
  627.          return data.  If <varC> is not long enough, COMET simply truncates
  628.          the data being returned.  If COMET increased <varC>'s length, the
  629.          database language's internal variable memory map could be
  630.          corrupted.
  631.  
  632.  
  633.          Errors:
  634.  
  635.          If COMET is passed an invalid command name or parameter, then the
  636.          first one or two characters of <varC> will be modified with an
  637.          appropriate error code as detailed in appendix A.  A simple way
  638.          then to test whether COMET is reporting an error is to compare the
  639.          first two letters of returned <varC> against the first two letters
  640.          of the command name requested.
  641.  
  642.  
  643.          NOTE: It is highly recommended that you implement a single
  644.          procedure or function to do all CALLs to COMET.  In addition to
  645.          performing the actual CALL using the procedure's parameters, it
  646.          should test for any COMET reported errors as described above.
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.                                         - 7 -
  661.          COMMANDS - CALLING CONVENTIONS (cont'd)
  662.  
  663.          Example 1:
  664.  
  665.           * Open and initialize COM port #1 for use
  666.          OpenCmd = "OPEN COM1:2400,N,8,1"
  667.          CALL COMETMP WITH OpenCmd
  668.  
  669.           *Now test for an error by testing 1st two chars of OpenCmd
  670.          OpenWasOK = IIF(OpenCmd = "OP", .T., .F.)
  671.  
  672.           *If OPENed ok, send text "Hello World" and CR/LF
  673.          IF OpenWasOK
  674.            OutputCmd = "OUTPUT #1,Hello World" + CHR(13) + CHR(10)
  675.            CALL COMETMP WITH OutputCmd
  676.          ELSE
  677.            ? "COMET OPEN command failed!"
  678.          ENDIF
  679.  
  680.  
  681.           Example 2:
  682.  
  683.          *This code demonstrates the recommended way to perform all COMET
  684.          *commands using a centralized CALLing procedure approach that
  685.          *tests for COMET reported errors.
  686.  
  687.  
  688.          OpenWasOk = COMET_CALL("OPEN COM1:2400,N,8,1")
  689.          IF OpenWasOk
  690.           OutputOk = COMET_CALL("OUTPUT #1,Hello World" +CHR(13) + CHR(10))
  691.          ELSE
  692.           ? "COMET OPEN command failed!"
  693.          ENDIF
  694.  
  695.          .
  696.          .
  697.          .
  698.  
  699.  
  700.          FUNCTION COMET_CALL      && PROCEDURE stmt if dBASEIII/FoxBase
  701.          PARAMETERS CometCmd
  702.  
  703.           * Save 1st 2 letters of command name so we can test for errors
  704.          Command1_2 = LEFT(CometCmd, 2)
  705.  
  706.          CALL COMETMP WITH CometCmd      && Perform COMET command
  707.  
  708.           *Now see if COMET reported any errors
  709.          Ok = IIF(CometCmd = Command1_2, .T., .F.)
  710.  
  711.          RETURN Ok                       && Return command success/failure
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.                                         - 8 -
  727.          COMMAND REFERENCE FORMAT:
  728.  
  729.          The following describes notation conventions used throughout the
  730.          command reference section of this manual.
  731.  
  732.          ENTRY: - Specifies the required syntax and format of the character
  733.          type variable passed to COMET  for a particular command.
  734.  
  735.          <varC> - The character type variable that must be passed following
  736.          the WITH clause of the CALL statement.  This character expression
  737.          is usually a variable rather than a constant so that data or error
  738.          messages from COMET can be retrieved.
  739.  
  740.          RETURN: - Specifies the contents of <varC> after COMET has updated
  741.          the variable with any results/data being returned.
  742.  
  743.          [ ]    - Used to indicate either optional command parameters that
  744.          can be supplied upon entry, or data that might be returned by
  745.          COMET depending on circumstances.  The brackets are not part of
  746.          <varC> unless explicitly stated for a given command.
  747.  
  748.  
  749.          |      - Means OR,  indicating that 1 or more choices exist.
  750.                   eg. Expr1 | Expr2 means expression1 OR expression2 can be
  751.                   used.
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.          NOTE:
  785.          Parameters that require numeric values as part of <varC> can be
  786.          entered in decimal or hexadecimal format.  Decimal is assumed by
  787.          default unless a number is preceded by an "x" or "X".
  788.  
  789.          eg.  100    =  decimal 100
  790.              x100    =  decimal 256  (hex 0100)
  791.  
  792.                                         - 9 -
  793.          COMMAND: ARECV and ARECVA
  794.  
  795.          ENTRY: <varC> = "ARECV|ARECVA #P, filespec [,timeout]"
  796.  
  797.           #P = desired port # (1-5)
  798.           filespec = DOS path\filename
  799.           timeout  = # seconds before auto-close (0 - 3600)
  800.  
  801.  
  802.          RETURN: <varC> unchanged unless error
  803.  
  804.  
  805.          ERROR CODES:  (See appendix A for general error codes)
  806.            "xx" - port not OPEN
  807.            "-"  - busy (previous file transfer still active)
  808.  
  809.  
  810.          SEE ALSO: ASEND, FCHK, FLUSH, OPEN
  811.  
  812.  
  813.          PURPOSE:
  814.          Used to begin capturing of incoming COM port data into a specified
  815.          file.  ARECV creates a new file overwriting any existing file of
  816.          the same name, whereas ARECVA appends to an existing file.  The
  817.          optional timeout parameter specifies the duration of COM port
  818.          receiver inactivity before automatically closing the file and
  819.          canceling the capture.  The default timeout is 60 seconds.
  820.          Specify a value of 0 to disable auto-close feature.  Other than a
  821.          timeout, there are two other ways the file can be closed; if a DOS
  822.          End-Of-File (EOF = 1Ah = 26d) character is received or a FLUSH
  823.          command is given for this COM port.  When capturing is in progress
  824.          the COM port data can also be read from the receive buffer using
  825.          the INPUT command.  ARECV will use flow control to insure no data
  826.          is lost if the OPEN command has specified either Xon/Xoff or
  827.          Rts/cts methods.  Use FCHK to determine the number of bytes
  828.          captured at any time as well as determine if any data loss has
  829.          occurred. Unlike the XModem and Ymodem commands, ARECV will allow
  830.          OUTPUTting of data to the port even while capture is in progress.
  831.  
  832.  
  833.          EXAMPLE:
  834.  
  835.          * Initiates capturing of port #1 data to a new file with a default
  836.          * 60 second timeout.
  837.          RecvCmd = 'ARECV #1,\MYDIR\MYFILE.RCV'
  838.          CALL COMETMP WITH RecvCmd
  839.  
  840.          * Initiate capture, but append to existing file and no timeout.
  841.          RecvCmd2 = 'ARECVA #1,\DBASE\CAPTURE.TXT,0'
  842.          CALL COMETMP WITH RecvCmd2
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.                                        - 10 -
  859.          COMMAND: ASEND
  860.  
  861.          ENTRY: <varC> = "ASEND #P,filespec"
  862.  
  863.            #P = desired port # (1-5)
  864.            filespec = DOS path\filename
  865.  
  866.  
  867.          RETURN: <varC> = unchanged unless error
  868.  
  869.  
  870.          ERROR CODES:  (See appendix A for general error codes)
  871.            "xx" = port not OPEN
  872.            "-"  = busy (file transfer already active)
  873.  
  874.          SEE ALSO: ARECV, FCHK, FLUSH, OPEN
  875.  
  876.  
  877.          PURPOSE:
  878.          Used to begin sending of a file out the specified COM port.  No
  879.          error checking protocol is used as the file is simply copied out
  880.          the port.  Use only when either errors can be tolerated (eg. text
  881.          files), sender and receiver are directly wired together, or some
  882.          type of error correcting modems are in use.  Although this command
  883.          is normally used to send ASCII rather than binary files, all
  884.          characters will be sent including control characters.  It is the
  885.          size of the file that determines when ASEND completes.  ASEND will
  886.          respond to flow control if the port was OPENed with either
  887.          Xon/Xoff or Rts/cts specified.  Use FCHK to determine the number
  888.          of bytes sent so far.  Unlike the XModem and Ymodem commands,
  889.          ASEND will allow INPUTting of data from the port even while
  890.          sending is in progress.  To cancel ASEND at any time, issue a
  891.          FLUSH command.
  892.  
  893.  
  894.          EXAMPLE:
  895.  
  896.          * Send a file out port #1
  897.          SendCmd = 'ASEND #1,\MYDIR\MYFILE'
  898.          CALL COMETMP WITH SendCmd
  899.          *Note how COMET returns immediately while file gets sent in the
  900.          *background.
  901.  
  902.          *Some time later, get file status
  903.          SendChk = 'FCHK #1,' + SPACE(80)
  904.          CALL COMETMP WITH SendChk
  905.          @ 24, 0 SAY SendChk              && Display current status
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                                        - 11 -
  925.          COMMAND: BUFFER
  926.  
  927.          ENTRY: <varC> = "BUFFER #P, [seg: len]"
  928.  
  929.            #P = desired port # (1-5)
  930.            seg   = segment address for start of buffer
  931.            len   = length of buffer in bytes (must be > 1024d)
  932.  
  933.  
  934.          RETURN: <varC> = unchanged unless error
  935.  
  936.  
  937.          ERROR CODES: (See appendix A for general error codes)
  938.  
  939.            "?s" = Illegal/missing  segment address
  940.            "?l" = Illegal/missing length
  941.  
  942.  
  943.          SEE ALSO:  OPEN
  944.  
  945.  
  946.          PURPOSE:
  947.          This command allows the default buffer size and/or location to be
  948.          overridden for the specified port.  By default COMET reserves 1024
  949.          bytes for each port's buffer.  This buffer space is used for:
  950.  
  951.           1) All received data, including file receive operations
  952.           2) Data being transmitted, only for file send operations
  953.  
  954.          In some cases the 1024 byte buffer may be too small resulting in
  955.          lost data as can be determined by FCHK's or RXCNT's buffer
  956.          overflow error messages.  In most buffer overflow cases though,
  957.          the problem can easily be solved by specifying some form of flow
  958.          control in the OPEN command.  If the sending device doesn't
  959.          support flow control, then increasing the buffer size may be the
  960.          only solution.
  961.  
  962.          There are 2 ways to specify a custom buffer location/size:
  963.  
  964.  
  965.          All Languages:
  966.            If a segment address and buffer length are given, COMET will use
  967.          memory starting at seg:0000 for a length of len bytes for the
  968.          port's buffer.  No checking is done to see if this memory
  969.          requested conflicts with other programs, so be sure the region
  970.          specified is unused.  This allows one to create very large buffers
  971.          in DOS's high memory area without reducing the amount of
  972.          conventional memory available to DOS and programs.  The largest
  973.          length for any one buffer is 64k (65536 bytes).
  974.  
  975.  
  976.          Clipper ONLY:
  977.            If only a length parameter is passed, COMET will request a
  978.          memory block from DOS that is len bytes long.
  979.  
  980.          eg. <varC> = "BUFFER #1, x1000" will attempt to establish a new
  981.          buffer that is 1000h (4096d) bytes in size.
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.                                        - 12 -
  991.          COMMAND: BUFFER (cont'd)
  992.  
  993.  
  994.          EXAMPLE:
  995.  
  996.           *Method 2 - create new buffer starting at C000:0000 for 8000
  997.           *bytes (8000 decimal, could also have been x2000)
  998.          HiMemBuff = "BUFFER #1, xC000:  8000"
  999.          CALL COMETMP WITH HiMemBuff
  1000.  
  1001.  
  1002.  
  1003.          NOTE:
  1004.          Segment and length values may be in either heXidecimal or decimal
  1005.          format. Hexadecimal numbers must be preceded by an upper or
  1006.          lowercase x.
  1007.  
  1008.          When a port gets CLOSEd, any custom buffer information is lost and
  1009.          must be specified again after the port is once again OPENed.
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.                                        - 13 -
  1057.          COMMAND: CLOSE
  1058.  
  1059.          ENTRY: <varC> = "CLOSE [#P]"
  1060.  
  1061.            #P = desired port # (1-5)
  1062.  
  1063.  
  1064.          RETURN: <varC> = unchanged
  1065.  
  1066.  
  1067.          ERROR CODES:  (See appendix A for general error codes)
  1068.  
  1069.            "xx" = port not OPEN
  1070.  
  1071.  
  1072.          SEE ALSO: FLUSH, OPEN
  1073.  
  1074.          PURPOSE:
  1075.          To shut down one or all currently OPENed COM ports.  If no #P
  1076.          parameter specified, then all OPEN ports will be closed and no
  1077.          longer available until reOPENed.  Any ports closed will have their
  1078.          respective Data Terminal Ready (DTR) and Clear-To-Send (CTS)
  1079.          outputs turned off.  Additionally, if the port(s) have active file
  1080.          transfers going on, these will be terminated and files closed.  It
  1081.          is a good practice to issue the CLOSE command before exiting or
  1082.          QUITing from your database program, even though COMET
  1083.          automatically closes ports and files when exiting.
  1084.  
  1085.  
  1086.          EXAMPLE:
  1087.  
  1088.          * Let's shut down just port #4
  1089.          Clos4 = "CLOSE #4"
  1090.          CALL COMETMP WITH Clos4
  1091.  
  1092.  
  1093.          * Let's shut down all OPEN ports
  1094.          ClosAll = 'CLOSE'
  1095.          CALL COMETMP WITH ClosAll
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.                                        - 14 -
  1123.          COMMAND: DTR
  1124.  
  1125.          ENTRY: <varC> = "DTR #P,n"
  1126.  
  1127.            #P = desired port # (1-5)
  1128.            n = 0  or  1
  1129.  
  1130.  
  1131.          RETURN: <varC> = unchanged
  1132.  
  1133.  
  1134.          PURPOSE:
  1135.          To set the state of the COM port's Data Terminal Ready (DTR)
  1136.          output signal. Specify 1 to set the signal active, 0 to disable.
  1137.          By default, the signal is set to an active (1) state after the COM
  1138.          port is OPENed.  Data Terminal Ready is output from the PC's
  1139.          serial COM port to whatever device is attached to the port.  If a
  1140.          modem is attached,  this signal is normally required to be at an
  1141.          active (1) state before the modem will respond to any commands it
  1142.          receives.  Furthermore most Hayes compatible modems will
  1143.          automatically disconnect from the telephone line if Data Terminal
  1144.          Ready should change from a 1 to a 0 state during a call.  With
  1145.          modems then, the DTR command is a simple way to force a modem to
  1146.          disconnect or hangup.
  1147.  
  1148.  
  1149.          EXAMPLE:
  1150.          DTROn = 'DTR #2,1'
  1151.          DTROff = 'DTR #2,0'
  1152.          CALL COMETMP WITH DTROn   && Set DTR active
  1153.          CALL COMETMP WITH DTROff  && Now, turn DTR off
  1154.  
  1155.  
  1156.          NOTE:  Some modems have a dip switch or configuration setting that
  1157.          can override the Data Terminal Ready disconnect feature.  Consult
  1158.          your modem's manual for details.
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.                                        - 15 -
  1189.          COMMAND: FCHK
  1190.  
  1191.          ENTRY: <varC> = "FCHK #P," + SPACE(80)
  1192.  
  1193.            #P = desired port # (1-5)
  1194.  
  1195.  
  1196.          RETURN: <varC> = "FCHK #P,prot,dir,stat,size,file [warn][fail]"
  1197.  
  1198.            prot = "ASCII ", "XMODEM" or "YMODEM"        ( 9, 6)
  1199.            dir  = "RECEIVE " or "TRANSMIT"              (16, 8)
  1200.            stat = "ACTIVE  ", "COMPLETE" or "FAILED  "  (25, 8)
  1201.            size = "#######" (bytes rec'd or sent)       (34, 7)
  1202.            file = path\name of file                     (42, ?)
  1203.  
  1204.            [warn] = [DATA LOSS]
  1205.            [fail] = [CANCELED], [DATA ERRORS], [FILE: OPEN READ],
  1206.                   [FILE: WRITE], or [TIMEOUT]
  1207.  
  1208.  
  1209.          ERROR CODES:  (See appendix A for general error codes)
  1210.  
  1211.            "xx" = port not OPEN
  1212.  
  1213.  
  1214.          SEE ALSO: ARECV, ASEND, XRECV, XSEND, YRECV, YSEND
  1215.  
  1216.  
  1217.          PURPOSE:
  1218.          To determine the file transfer status of a specified port.  FCHK
  1219.          reports the active file transfer protocol, direction, status, size
  1220.          in bytes transfered so far, file path/name and possible warning or
  1221.          failure messages.  Except for the possible warning and failure
  1222.          messages, each value returned has a fixed starting position and
  1223.          length within <varC> to simplify extracting when using the SUBSTR
  1224.          function. Note that both the delimiting commas and brackets are
  1225.          returned in <varC>.  Once FCHK reports a finished status (ie.
  1226.          COMPLETE or FAILED), subsequent calls to FCHK will report the word
  1227.          "IDLE" to indicate that no file transfer is active until another
  1228.          file transfer command gets issued.  Since COMET does not directly
  1229.          display file transfer status, one use for FCHK would be to
  1230.          periodically display this status.  Used in conjunction with the
  1231.          ONTIME command, it is possible to automatically do a procedure
  1232.          that displays current FCHK values every so often.  When FCHK
  1233.          reports a FAILED status, [fail] will contain one of the following
  1234.          messages indicating the reason for failure:
  1235.  
  1236.            [CANCELED] - File transfer got canceled by either a FLUSH
  1237.                       command or receiver/sender requested cancel.
  1238.  
  1239.            [DATA ERRORS] - Too many data related errors occurred probably
  1240.                          due to noisy phone line when modems are involved.
  1241.  
  1242.            [FILE: OPEN/READ] - Couldn't open requested file or a non
  1243.                              recoverable disk read error.
  1244.  
  1245.            [FILE: WRITE] - Non recoverable disk write error
  1246.  
  1247.            [TIMEOUT] - Receiver/sender fails to respond.  With ARECV,
  1248.                      indicates no data has been received for 60 seconds or
  1249.                      user specified timeout value.
  1250.  
  1251.  
  1252.  
  1253.  
  1254.                                        - 16 -
  1255.          COMMAND: FCHK  (cont'd)
  1256.  
  1257.  
  1258.          In addition, a warning message of "[DATA LOSS]" may be returned if
  1259.          the file protocol was ARECV and data was lost due to buffer
  1260.          overflow.  If this warning occurs, you may need to implement some
  1261.          form of flow control for this port (see OPEN).
  1262.  
  1263.  
  1264.          NOTE:
  1265.          The length of <varC> required to fit all of FCHK's returned values
  1266.          will vary depending on the file path/name.  Be sure to allow
  1267.          sufficient space or COMET will truncate items.
  1268.  
  1269.  
  1270.          EXAMPLE:
  1271.  
  1272.          StatCmd = 'FCHK #1,' + SPACE(80)
  1273.          CALL COMETMP WITH StatCmd
  1274.  
  1275.          Stus = SUBSTR(StatCmd,25,8)   && Extract status
  1276.          Cnt =  SUBSTR(Statcmd,34,7)   && Extract byte count
  1277.          Last3 = SUBSTR(StatCmd,42)    && File name + [fail] + [warn]
  1278.          SpcAt = AT(' ',Last3)         && Find space after path\file name
  1279.          FName = SUBSTR(Last3,SpcAt-1) && Now we have path\file name
  1280.          @ 24,0 SAY 'File:' + FName
  1281.          @ 24,15 SAY 'Status: ' + Stus
  1282.          @ 24,30 SAY '# Bytes: ' + Cnt
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.          .
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.                                        - 17 -
  1321.          COMMAND: FIND and FINDI
  1322.  
  1323.          ENTRY: <varC> = "FIND|FINDI #P, string"
  1324.  
  1325.            #P = desired port # (1-5)
  1326.            string = character(s) to find
  1327.  
  1328.  
  1329.          RETURN: <varC> = "FIND|FINDI #P,?string"
  1330.  
  1331.            ? = plus sign(+) if string found; space if not found
  1332.  
  1333.  
  1334.          ERROR CODES:  (See appendix A for general error codes)
  1335.  
  1336.            "xx" = port not OPEN
  1337.  
  1338.  
  1339.          PURPOSE:
  1340.          To search COMET's receive buffer for a character string.  If
  1341.          string is found, the space character following #P, will be
  1342.          replaced with a plus sign character, "+".  The FINDI form of the
  1343.          command specifies a case Insensitive search.  If found, the buffer
  1344.          pointer advances to the first character of string essentially
  1345.          skipping over any characters prior to string that hadn't been read
  1346.          from the buffer.  This leaves the buffer pointer set so that the
  1347.          next INPUT command would return data starting with string.
  1348.  
  1349.          If string can't be found, <varC> will remain unchanged so that the
  1350.          repeated CALLs to COMETMP can be made with the same <varC> until a
  1351.          "+" is reported.
  1352.  
  1353.  
  1354.          EXAMPLE:
  1355.  
  1356.           * Assume buffer holds: "abcdeFghijk"
  1357.           * Do a case insensitive search for "DEF"
  1358.          FindCmd = "FINDI #1, DEF"
  1359.  
  1360.           * Stay in a loop till "DEF" found
  1361.          DO WHILE .NOT. '+' $ FindCmd   && Loop till found
  1362.           CALL COMETMP WITH FindCmd
  1363.          ENDDO
  1364.  
  1365.           * FindCmd now = "FINDI #1,+DEF"
  1366.           * FIND moved pointer so buffer now holds: "deFghijk"
  1367.           * Now let's read in upto 10 chars from buffer
  1368.           * COMET replaces the xxxxx with the # chars returned from buffer
  1369.           Inp = "INPUT #1, xxxxx" + SPACE(10)
  1370.           CALL COMETMP WITH Inp
  1371.  
  1372.           * Inp now = "INPUT #1, 00008deFghijk  "
  1373.  
  1374.  
  1375.  
  1376.  
  1377.          NOTE:  <varC> must contain a space after #P, which will be a place
  1378.          holder for the plus sign if string is found.  This space is not
  1379.          going to be included in the search.  The 1st character of the
  1380.          search string is always the second character after the comma.
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.                                        - 18 -
  1387.          COMMAND: FLAVOR
  1388.  
  1389.          ENTRY: <varC> = "FLAVOR fl"
  1390.  
  1391.            fl:  C7 = Clipper, summer 87
  1392.                 C5 = Clipper 5.0
  1393.                 D3 = dBASEIII
  1394.                 D4 = dBASEIV
  1395.                 FB = FoxBase
  1396.                 FP = FoxPro
  1397.                 QS = QuickSilver or dBXL
  1398.  
  1399.          RETURN: <varC> = unchanged unless error
  1400.  
  1401.  
  1402.          ERROR CODES:
  1403.  
  1404.            ?f = illegal/missing value for language flavor
  1405.  
  1406.  
  1407.          SEE ALSO: ONDCD, ONDONE, ONTIME
  1408.  
  1409.  
  1410.          PURPOSE:
  1411.          To specify the database language or flavor being used with COMET.
  1412.          This information is used by COMET internally in situations where
  1413.          different courses of action need to be taken for certain
  1414.          languages.  Currently, only dBASEIV users need to use this command
  1415.          as the ON...  event trapping commands will not work reliably under
  1416.          dBASEIV unless the flavor is set to D4.  In future versions of
  1417.          COMET more language specific situations may arise so it is highly
  1418.          recommended that the proper FLAVOR command be the first command
  1419.          CALLed.
  1420.  
  1421.  
  1422.          EXAMPLE:
  1423.  
  1424.           * Specify dBASEIV flavor
  1425.          MyFlav = "FLAVOR D4"
  1426.          CALL COMETMP WITH MyFlav
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.                                        - 19 -
  1453.          COMMAND: FLUSH
  1454.  
  1455.          ENTRY: <varC> = "FLUSH #P"
  1456.  
  1457.          RETURN: <varC> = unchanged
  1458.  
  1459.          ERROR CODES:  (See appendix A for general error codes)
  1460.  
  1461.            "xx" = port not OPEN
  1462.  
  1463.          PURPOSE:
  1464.          This command performs several actions.  First, it always empties
  1465.          out the COM port receive buffer and clears any paused condition
  1466.          due to flow control.  Secondly, if any type of file transfer is in
  1467.          progress, it gets canceled.  FCHK will report the status as
  1468.          CANCELED in this instance.  This is a simple way to cancel any
  1469.          active file transfer, regardless of type.  Also used to clear the
  1470.          buffer to a known empty state.
  1471.  
  1472.  
  1473.          EXAMPLE:
  1474.  
  1475.          * Start an XModem file send
  1476.          Send = "XSEND #1,\DBF\SALES.DBF"
  1477.  
  1478.  
  1479.          * Allow user to cancel file send by hitting ESC key
  1480.          Flsh = 'FLUSH #1'
  1481.          ON ESCAPE CALL COMETMP WITH Flsh
  1482.          SET ESCAPE ON
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.                                        - 20 -
  1519.          COMMAND: INPUT
  1520.  
  1521.          ENTRY: <varC> = "INPUT #P,?????" + SPACE(cnt) [ + CHR(t)]
  1522.  
  1523.             #P = desired port # (1-5)
  1524.            cnt = # of chars to get from buffer (maximum)
  1525.              t = optional input termination character's value
  1526.  
  1527.          RETURN: <varC> = "INPUT #P,nnnnndd .. d"
  1528.  
  1529.            nnnnn   = # characters read from buffer and returned
  1530.            dd ..d  = COM port data
  1531.  
  1532.          ERROR CODES:  (See appendix A for general error codes)
  1533.  
  1534.            "xx" = port not OPEN
  1535.            "-"  = busy (file transfer active)
  1536.  
  1537.  
  1538.          SEE ALSO: OUTPUT, RXCNT
  1539.  
  1540.  
  1541.          PURPOSE:
  1542.          To read data from specified COM port's receive data buffer.  The
  1543.          amount of data that will be returned is controlled by several
  1544.          factors:
  1545.  
  1546.           1) The length of <varC> determines the maximum number of
  1547.              characters that can be returned.  This amount is limited to
  1548.              cnt characters if no termination character specified, cnt + 1
  1549.              if a termination character is specified.
  1550.  
  1551.           2) If a termination character is specified and this character is
  1552.              present within the buffer's data, only data upto and including
  1553.              the termination character will be returned leaving the buffer
  1554.              pointer at the character following the terminator.
  1555.  
  1556.           3) If no data is waiting in buffer or all of it has been written
  1557.              into <varC> without encountering conditions 1 or 2, COMET will
  1558.              exit the INPUT command.
  1559.  
  1560.          <varC>'s nnnnn will reflect the number of characters that COMET
  1561.          has returned.  This decimal number will always be 5 digits and
  1562.          left zero filled immediately followed by the returned data.
  1563.  
  1564.  
  1565.          EXAMPLE:
  1566.  
  1567.           * Assume buffer contains: "Hello World" + Cr + Lf
  1568.           * Let's read just the first 3 chars
  1569.          RdInp = "INPUT #1,?????" + SPACE(3)
  1570.          CALL COMETMP WITH RdInp
  1571.           * RdInp now = "INPUT #1,00003Hel"
  1572.          Cnt = VAL(SUBSTR(RdInp,10,5))    && Get # chars returned = 3
  1573.          Data = SUBSTR(RdInp,15,Cnt)      && "Hel"
  1574.  
  1575.           * Now let's find out how many more chars are in buffer and INPUT
  1576.           * them all.
  1577.          CntLeft = "RXCNT #1,     "   && Get count of # chars left in buff
  1578.          CALL COMETMP WITH CntLeft
  1579.           * Now CntLeft = "RXCNT #1,00010"
  1580.          CntLeft = VAL(SUBSTR, CntLeft, 10)
  1581.  
  1582.  
  1583.  
  1584.                                        - 21 -
  1585.          COMMAND: INPUT (cont'd)
  1586.  
  1587.  
  1588.           * INPUT, specifying a Lf, CHR(10), termination character
  1589.          RdInp2 = "INPUT #1,?????" + SPACE(CntLeft) +CHR(10)
  1590.          CALL COMETMP WITH RdInp2
  1591.           * Now RdInp = "INPUT #1,lo World" + Cr + Lf
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                        - 22 -
  1651.          COMMAND: MSTAT
  1652.  
  1653.          ENTRY: <varC> = "MSTAT #P," + SPACE(18)
  1654.  
  1655.            #P = desired port # (1-5)
  1656.  
  1657.  
  1658.          RETURN: <varC> = "MSTAT #P,?DCD ?RI ?DSR ?CTS"
  1659.  
  1660.            ? =  plus sign (+) if active, minus sign (-) if inactive
  1661.  
  1662.  
  1663.          ERROR CODES:  (See appendix A for general error codes)
  1664.  
  1665.            "xx" = port not OPEN
  1666.  
  1667.  
  1668.          PURPOSE:
  1669.          To determine the state of the four modem status input signals at
  1670.          the specified COM port.  The command always returns the four
  1671.          signal abbreviations with each one preceded by either a plus or
  1672.          minus sign to indicate active or not.  This command can be called
  1673.          repetitively to poll the port's status for a desired state, such
  1674.          as testing for modem connect by waiting for "+DCD" to be returned.
  1675.  
  1676.          SIGNALS:                        PIN#   25 PIN CONN     9 PIN CONN
  1677.           DCD - Data Carrier Detect ...............  8               1
  1678.           RI  - Ring Indicator .................... 22               9
  1679.           DSR - Data Set Ready ....................  6               6
  1680.           CTS - Clear To Send .....................  5               8
  1681.  
  1682.          EXAMPLE:
  1683.  
  1684.           * Let's have a modem dial a #
  1685.          DialCmd = "OUTPUT #1,ATTD555-1212" + CHR(13)
  1686.          CALL COMETMP WITH DialCmd
  1687.  
  1688.           * And now we'll wait till DCD goes active indicating our modem
  1689.           * has connected
  1690.          MdmStat = "MSTAT #1," + SPACE(18)
  1691.          DO WHILE .NOT. '+DCD' $ MdmStat  && Wait for DCD
  1692.            CALL COMETMP WITH MdmStat
  1693.          ENDDO
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.                                        - 23 -
  1717.          COMMAND: ONDCD
  1718.  
  1719.          ENTRY: <varC> = "ONDCD #P,a,x"
  1720.  
  1721.            #P = desired port # (1-5)
  1722.  
  1723.            a = key's ASCII code value
  1724.                Specify 0 if key has no ASCII value (ie. F1)
  1725.  
  1726.            x = key's auXilary-byte value (see appendix B).
  1727.                Specify 0 if key has an ASCII value.
  1728.  
  1729.          RETURN: <varC> = unchanged
  1730.  
  1731.  
  1732.          ERROR CODES:  (See appendix A for general error codes)
  1733.  
  1734.            "xx" = port not OPEN
  1735.  
  1736.          SEE ALSO: ONDONE, ONTIME, MSTAT
  1737.  
  1738.          PURPOSE:
  1739.          This event trap command instructs COMET's background process to
  1740.          signal the database program whenever a change in the Data Carrier
  1741.          Detect (DCD) input signal occurs at the specified port.  COMET
  1742.          does this by stuffing a user specified keystroke directly into
  1743.          DOS's keyboard buffer whenever a transition in the DCD signal
  1744.          occurs.  This keystroke is defined by specifying the key's ASCII
  1745.          and auxilary byte values (see appendix B).  To force the
  1746.          database program to execute a specific procedure in response to
  1747.          the DCD event, the program should have previously set up an
  1748.          appropriate key trap command (ie.  ON ESCAPE, ON KEY n, or SET KEY
  1749.          n).  This provides an easy way for a program to automatically jump
  1750.          to a special procedure whenever a modem connects or disconnects.
  1751.          Use MSTAT to determine whether DCD is active or inactive.
  1752.  
  1753.  
  1754.          EXAMPLE:
  1755.  
  1756.          ********* Clipper example code ********************
  1757.          * Tell Clipper to DO DCDProc if F10 key entered
  1758.          SET KEY -9 TO DCDProc
  1759.  
  1760.          * Have COMET stuff F10 key if DCD at port #1 changes
  1761.          DCDCmd = 'ONDCD #1,0,68'  && ASCII & Aux-Byte for F10
  1762.          CALL COMETMP WITH DCDCmd
  1763.  
  1764.          ******** dBASE, Fox, dBXL or QuickSilver ***********
  1765.          ON ESCAPE DO DCDProc
  1766.          SET ESCAPE ON
  1767.  
  1768.          * Have COMET simulate ESC key if DCD changes at port #1
  1769.          DCDCmd = 'ONDCD #1,27,0'
  1770.          CALL COMETMP WITH DCDCmd
  1771.  
  1772.          * main application code goes here
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.                                        - 24 -
  1783.          COMMAND: ONDCD  (cont'd)
  1784.  
  1785.  
  1786.          PROCEDURE DCDProc
  1787.  
  1788.           * Get current DCD state
  1789.          COMStat = 'MSTAT #1' + SPACE(18)
  1790.          CALL COMETMP WITH COMStat  && Chk if DCD + or -
  1791.  
  1792.          IF '+DCD' $ COMStat
  1793.           DO HaveDCD  && A proc that might do file transfers
  1794.          ELSE
  1795.           DO LostDCD  && A Proc that deals with disconnects
  1796.          ENDIF
  1797.          RETURN
  1798.  
  1799.  
  1800.  
  1801.          NOTE:
  1802.          To disable DCD event trapping don't specify any key parameters
  1803.          (ie.  <varC> = "ONDCD #1") .
  1804.  
  1805.          dBASEIV: Set FLAVOR command to D4
  1806.  
  1807.          CLIPPER USERS: See notes in appendix B
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.                                        - 25 -
  1849.          COMMAND: ONDONE
  1850.  
  1851.          ENTRY: <varC> = "ONDONE #P,a,x"
  1852.  
  1853.            #P = desired port # (1-5)
  1854.  
  1855.            a = key's ASCII code value.
  1856.                Specify 0 if key has no ASCII value (ie. F1)
  1857.  
  1858.            x = key's auXilary-byte value (see appendix B).
  1859.                Specify 0 if key has an ASCII value.
  1860.  
  1861.          RETURN: <varC> = unchanged error
  1862.  
  1863.          ERROR CODES:  (See appendix A for general error codes)
  1864.  
  1865.            "xx" = port not OPEN
  1866.  
  1867.          SEE ALSO: ONDCD, ONTIME, FCHK
  1868.  
  1869.          PURPOSE:
  1870.          This command instructs COMET's background process to signal the
  1871.          database program whenever a file transfer is done, either due to
  1872.          normal completion or failure.  COMET does this by writing the
  1873.          ASCII and auxilary bytes values specified directly into DOS's
  1874.          keyboard buffer.  To force the database program to execute a
  1875.          specific procedure when a file transfer is done, the program
  1876.          should have previously set up an appropriate key trap command (ie.
  1877.          ON ESCAPE, ON KEY n, or SET KEY n).
  1878.  
  1879.          EXAMPLE:
  1880.  
  1881.          ********* Clipper example code ********************
  1882.          * Tell Clipper to DO DoneProc if S/F10 entered
  1883.          SET KEY -19 TO DoneProc
  1884.  
  1885.          * Have COMET simulate S/F10 upon file completion/failure
  1886.          DoneCmd = 'ONDONE #1,0,93'  && ASCII & Aux-Byte for S/F10
  1887.          CALL COMETMP WITH DoneCmd
  1888.  
  1889.          ******** dBASE, Fox, dBXL or QuickSilver ***********
  1890.          ON ESCAPE DO DoneProc
  1891.          SET ESCAPE ON
  1892.  
  1893.          * Have COMET simulate ESC key upon file completion
  1894.          DoneCmd = 'ONDONE #1,27,0'
  1895.          CALL COMETMP WITH DoneCmd
  1896.          *
  1897.          * main application code goes here
  1898.          *
  1899.          PROCEDURE DoneProc
  1900.          * Let's disconnect after file transfer is done
  1901.          HangUp = 'DTR #1,0'
  1902.          CALL COMETMP WITH HangUp  && Modem disconnect
  1903.          RETURN
  1904.  
  1905.  
  1906.          NOTE: To disable ONDONE event trapping, don't specify any key
  1907.          parameters (ie. <varC> = "ONDONE #1").
  1908.  
  1909.          CLIPPER USERS:  See notes in appendix B
  1910.  
  1911.          dBASEIV: Set FLAVOR to D4
  1912.  
  1913.  
  1914.                                        - 26 -
  1915.          COMMAND: ONTIME
  1916.  
  1917.          ENTRY: <varC> = "ONTIME t,a,x"
  1918.  
  1919.            t = time interval in seconds between events
  1920.  
  1921.            a = key's ASCII code value.
  1922.                Specify 0 if key has no ASCII value (ie. F1)
  1923.  
  1924.            x = key's auXilary-byte value (see appendix B).
  1925.                Specify 0 if key has an ASCII value.
  1926.  
  1927.          RETURN: <varC> = unchanged unless error
  1928.  
  1929.          ERROR CODES:  (See appendix A for general error codes)
  1930.  
  1931.  
  1932.          SEE ALSO: ONDCD, ONDONE
  1933.  
  1934.  
  1935.          PURPOSE:
  1936.          This command instructs COMET's background process to signal the
  1937.          database program every t seconds.  COMET does this by writing the
  1938.          ASCII and auxilary bytes values specified directly into DOS's
  1939.          keyboard buffer.  To force the database program to execute a
  1940.          specific procedure every t seconds, the program should have
  1941.          previously set up an appropriate key trap command (ie.  ON ESCAPE,
  1942.          ON KEY n, or SET KEY n).
  1943.  
  1944.          EXAMPLE:
  1945.  
  1946.          ********* Clipper example code ********************
  1947.          * Tell Clipper to DO TimeProc if S/F10 entered
  1948.          SET KEY -19 TO TimeProc
  1949.  
  1950.          * Have COMET simulate S/F10 every 5 seconds
  1951.          TimeCmd = 'ONTIME 5,0,93'  && ASCII & Aux-Byte for S/F10
  1952.          CALL COMETMP WITH TimeCmd
  1953.  
  1954.          ******** dBASE, Fox, dBXL or QuickSilver ***********
  1955.          ON ESCAPE DO TimeProc
  1956.          SET ESCAPE ON
  1957.  
  1958.          * Have COMET simulate ESC key upon file completion
  1959.          TimeCmd = 'ONTIME 5,27,0'
  1960.          CALL COMETMP WITH TimeCmd
  1961.          *
  1962.          * main application code goes here
  1963.          *
  1964.          PROCEDURE TimeProc
  1965.          *
  1966.          * This procedure will execute every 5 seconds
  1967.          *
  1968.          RETURN
  1969.  
  1970.  
  1971.  
  1972.          NOTE: To disable ONTIME event trapping, don't specify any
  1973.          parameters (ie. <varC> = "ONTIME").
  1974.  
  1975.          CLIPPER USERS: See notes in appendix B
  1976.  
  1977.          dBASEIV: Set FLAVOR to D4
  1978.  
  1979.  
  1980.                                        - 27 -
  1981.          COMMAND: OPEN
  1982.  
  1983.          ENTRY: <varC> = "OPEN COMn[,a,i]:b,p,d,s[,f]"
  1984.  
  1985.            n = com port # to open ( 1 - 5)
  1986.            a = optional port hardware I/O address
  1987.            i = optional port hardware interrupt IRQ# (2-7)
  1988.            b = baud rate (300 - 38400)
  1989.            p = parity None, Even or Odd (N, E or O)
  1990.            d = # data bits (7 or 8)
  1991.            s = # stop bits (1 or 2)
  1992.            f = flow control; Xon/Xoff, Rts/cts, or None (X, R or N)
  1993.  
  1994.          ERROR CODES:  (See appendix A for general error codes)
  1995.  
  1996.            "-"  = busy                    "?p" = invalid parity
  1997.            "?n" = invalid port #          "?f" = invalid flow control
  1998.            "?a" = invalid address         "?d" = invalid # data bits
  1999.            "?i" = invalid IRQ#            "?s" = invalid # stop bits
  2000.            "?b" = invalid baud rate
  2001.  
  2002.          PURPOSE:
  2003.          To prepare or initialize the desired COM port to the specified
  2004.          settings.  A port must be OPEN before other commands can use it.
  2005.  
  2006.          IMPORTANT:
  2007.          COMET needs to know several hardware specific details about each
  2008.          COM port that is to be OPENed.  First, it needs to know the base
  2009.          I/O (input/output) address of the port so COMET knows where to
  2010.          read and write data from/to.  Secondly, COMET needs to know what
  2011.          interrupt line, or IRQ#, this port will use to "signal" COMET when
  2012.          the port needs to be serviced.  COMET needs to be signaled when
  2013.          important events occur (ie. a character has just been received or
  2014.          the port is able to send a character).
  2015.  
  2016.          If you are using an industry standard COM1 or COM2 as defined by
  2017.          the table on the following page, you don't need to specify any I/O
  2018.          address or IRQ# parameters as COMET will use these default values.
  2019.          While there are industry standards for COM3 and COM4 as far as I/O
  2020.          addresses, no standard exists as to what IRQ#'s are to be used.
  2021.          If your COM3 or COM4 conforms to the table below, you need not
  2022.          specify any address or IRQ# parameters as the defaults will be
  2023.          used.
  2024.  
  2025.          If your using non standard COM ports (ie. third party serial
  2026.          boards like DigiBoard or AST Research), you need to specify the
  2027.          I/O address and IRQ# parameters in the OPEN command.  Note that
  2028.          while each port must have a unique I/O address, ports can share
  2029.          the same interrupt IRQ#.  This allows multi-port boards that might
  2030.          have only 1 or 2 interrupt lines to work with COMET.  When
  2031.          specifying these parameters, the actual COM port number parameter,
  2032.          n, can be any value from 1 to 5.
  2033.  
  2034.          The COM port number parameter, n, serves two purposes.  First, if
  2035.          no I/O address and IRQ# parameters are present, COMET uses the
  2036.          default values for the specified port number n based on the table
  2037.          on the following page.  Secondly, it serves a port identifier for
  2038.          all other COMET commands which need to indicate a port.
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.                                        - 28 -
  2047.          COMMAND: OPEN (cont'd)
  2048.  
  2049.  
  2050.          Default Addresses and Interrupts:
  2051.  
  2052.            COMn    Address (hex)       IRQ#
  2053.            ----    -------------       ----
  2054.               1        x03F8             4
  2055.               2        x02F8             3
  2056.               3        x03E8             3
  2057.               4        x02E8             3
  2058.  
  2059.  
  2060.          EXAMPLE:
  2061.  
  2062.           * Let's OPEN port 1 as industry standard COM1 at 2400 baud, no
  2063.           * parity, 8 data bits, 1 stop bit and no flow control.
  2064.          OpenCmd = "OPEN COM1:2400,N,8,1,N"
  2065.          CALL COMETMP WITH OpenCmd
  2066.  
  2067.           * Let's open port 1 with custom base address of 0100 hex using
  2068.           * interrupt IRQ #7 and using Xon/xoff flow control.
  2069.          OpenCmd = "OPEN COM1,x0100,7:2400,N,8,1,X"
  2070.  
  2071.  
  2072.          NOTE:
  2073.          While each port OPENed must have a unique I/O address, it may
  2074.          share the same interrupt IRQ# with upto four other ports allowing
  2075.          upto five ports to use only one IRQ.  Third party multi port
  2076.          boards will typically only offer 1 or 2 interrupt IRQs for all
  2077.          their ports to share.
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.                                        - 29 -
  2113.          COMMAND: OUTPUT
  2114.  
  2115.          ENTRY: <varC> = "OUTPUT #P,string"
  2116.  
  2117.            #P = desired port # (1-5)
  2118.            string = character(s) to output
  2119.  
  2120.          RETURN: <varC> = unchanged
  2121.  
  2122.  
  2123.          ERROR CODES:  (See appendix A for general error codes)
  2124.  
  2125.            "xx" = port not OPEN
  2126.            "-"  = busy (file transfer active)
  2127.  
  2128.          SEE ALSO: INPUT, TXCNT
  2129.  
  2130.  
  2131.          PURPOSE:
  2132.          To output character(s) to the specified serial COM port.  If
  2133.          Xon/xoff or Rts/cts flow control was specified at OPEN time, COMET
  2134.          will monitor and pause output when receiver sends an Xoff
  2135.          character or lowers its CTS signal.  Use TXCNT command to
  2136.          determine output status.
  2137.  
  2138.  
  2139.          EXAMPLE:
  2140.  
  2141.           * Let's output a dial command to Hayes type modem
  2142.          OUTCmd = 'OUTPUT #2,ATDT(111)222-3333' + CHR(13)
  2143.          CALL COMETMP WITH OUTCmd
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.          NOTE:
  2172.          A null (binary 0) character can't be part of <varC> since its
  2173.          reserved to indicate or mark the end of character strings in the
  2174.          database environment.  To have COMET output a null, don't specify
  2175.          any string parameter. eg. <varC> = "OUTPUT #1,"  will
  2176.          output a single null character.
  2177.  
  2178.                                        - 30 -
  2179.          COMMAND: RTS
  2180.  
  2181.          ENTRY: <varC> = "RTS #P,n"
  2182.  
  2183.            #P = desired port # (1-5)
  2184.            n = 0 or 1
  2185.  
  2186.          RETURN: <varC> = unchanged
  2187.  
  2188.          ERROR CODES:  (See appendix A for general error codes)
  2189.  
  2190.            "xx" = port not OPEN
  2191.  
  2192.  
  2193.          PURPOSE:
  2194.          To set the state of the COM port's Request To Send (RTS) output
  2195.          signal.  This signal is set active (1) by default as soon as the
  2196.          COM port gets OPENed.  RTS can also change states if RTS/CTS
  2197.          handshaking was specified in the OPEN command and the receive
  2198.          buffer approaches 80% full in which case RTS goes low (0).
  2199.          Similarily, as the buffer empties to 20% of capacity the RTS
  2200.          signal will go active (1).  The buffer's default capacity is 1024
  2201.          characters but may be overridden with the BUFFER command.
  2202.  
  2203.  
  2204.  
  2205.          EXAMPLE:
  2206.  
  2207.           * Let's turn RTS on and then off at port #3
  2208.          RTSOn  = 'RTS #3,1'
  2209.          RTSOff = 'RTS #3,0'
  2210.          CALL COMETMP WITH RTSOn  && Set RTS active/on
  2211.          CALL COMETMP WITH RTSOff && Turn RTS off
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.                                        - 31 -
  2245.          COMMAND: RXCNT
  2246.  
  2247.          ENTRY: <varC> = "RXCNT #P," + SPACE(5)
  2248.  
  2249.            #P = desired port # (1-5)
  2250.  
  2251.  
  2252.          RETURN: <varC> = "RXCNT #P,n[nnnn][*]"
  2253.  
  2254.            n[nnnn] = # bytes waiting in receive buffer
  2255.            *       = buffer overflow indicator
  2256.  
  2257.          ERROR CODES:  (See appendix A for general error codes)
  2258.  
  2259.            "xx" = port not OPEN
  2260.  
  2261.          PURPOSE:
  2262.          To determine how many characters are pending in the receive
  2263.          buffer.  The default capacity of this buffer is 1024 characters
  2264.          but may be set to any size from 1024 to 65536 bytes.  No leading
  2265.          zeroes or spaces are returned for n.  This command is useful when
  2266.          you want to determine if a certain amount of data has arrived to
  2267.          the COM port.
  2268.  
  2269.          If RXCNT returns an asterisk following the count, this is an
  2270.          indication that the receive buffer for this port has overflowed.
  2271.          Data has not been INPUT from the port frequently enough to make
  2272.          room for new incoming data.  Try enabling some form of flow
  2273.          control in the OPEN command to correct this problem.
  2274.  
  2275.  
  2276.          EXAMPLE:
  2277.  
  2278.  
  2279.           * Assume that data is sent to port #2 in a block fashion (ie. a
  2280.           * constant throughput).  Let's determine when sender has finished
  2281.           * sending a block by waiting for RXCNT's value to level off.
  2282.           * We'll consider 1 second of no received data to indicate end of
  2283.           * block.
  2284.  
  2285.          LastRxCnt = GetRxCnt(2)       && Init to current cnt in buffer
  2286.          NoRxSince = SECONDS()         && Init secs cntr
  2287.          DO WHILE SECONDS() - NoRxSince < 1
  2288.            CurrRxCnt = GetRxCnt(2)
  2289.            IF CurrRxCnt # LastRxCnt    && Compare current RXCNT vs last
  2290.              NoRxSince = SECONDS()     && Got rec'd data, reset secs cntr
  2291.              LastRxCnt = CurrRxCnt     && Update buff cnt
  2292.            ENDIF
  2293.          ENDDO
  2294.  
  2295.          .
  2296.          .
  2297.          .
  2298.  
  2299.          FUNCTION GetRxCnt            && dBASEIII should use PROCEDURE stmt
  2300.          PARAMETERS PortN
  2301.  
  2302.          PortC = STR(PortN)
  2303.          GetCnt = "RXCNT #" + PortC + "," + SPACE(5)  && Build RXCNT <varC>
  2304.          CALL COMETMP WITH GetCnt
  2305.  
  2306.          RETURN VAL(SUBSTR(GetCnt,10)) && Return cnt of # chars in buffer
  2307.  
  2308.  
  2309.  
  2310.                                        - 32 -
  2311.          COMMAND STAT:
  2312.  
  2313.          ENTRY: <varC> = "STAT #P," + SPACE(3)
  2314.  
  2315.            #P = desired port # (1-5)
  2316.  
  2317.  
  2318.          RETURN: <varC> = "STAT #P,???"
  2319.  
  2320.            ? = F, P or O  (Framing, Parity or Overrun UART errors)
  2321.  
  2322.  
  2323.          PURPOSE:
  2324.          To read the line status of specified port's UART (Universal
  2325.          Asynchronous Receiver/Transmitter) chip.  In simple terms, this
  2326.          command reports on three classes of hardware detected errors for a
  2327.          given port #:  Framing, Parity and receiver Overrun errors.
  2328.          Parity errors indicate that the UART has reported one or more
  2329.          received characters with parity bit errors since the last time the
  2330.          STAT command was issued.  Overrun errors indicate that COMET has
  2331.          failed to read a received character from the UART before the next
  2332.          character arrived (ie. overran the UART's internal 1 character
  2333.          buffer).  For further information on UART errors please refer to
  2334.          technical books on serial communications.  COMET clears this error
  2335.          information every time this STAT command is issued.
  2336.  
  2337.  
  2338.  
  2339.          EXAMPLE:
  2340.  
  2341.          UARTStat = "STAT #1,   "
  2342.          CALL COMETMP WITH UARTStat
  2343.  
  2344.          UARTErrs = SUBSTR(UARTStat,9)        && Get error codes, if any
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.                                        - 33 -
  2377.          COMMAND: TXCNT
  2378.  
  2379.          ENTRY: <varC> = "TXCNT #P," + SPACE(5)
  2380.  
  2381.            #P = desired port # (1-5)
  2382.  
  2383.  
  2384.          RETURN: <varC> = "TXCNT #P,n[nnnn]"
  2385.  
  2386.            n[nnnn] = # bytes waiting in receive buffer
  2387.  
  2388.  
  2389.          ERROR CODES:  (See appendix A for general error codes)
  2390.  
  2391.            "xx" = port not OPEN
  2392.  
  2393.          PURPOSE:
  2394.          To determine how many characters are pending in the transmit
  2395.          buffer (non file related only).  Since COMET uses the actual
  2396.          <varC> memory variable for buffering, there is no fixed size or
  2397.          location for a port's transmit buffer.  No leading zeroes or
  2398.          spaces are returned for n.
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.                                        - 34 -
  2443.          COMMAND: VERS
  2444.  
  2445.          ENTRY: <varC> = "VERS" + SPACE(20)
  2446.  
  2447.  
  2448.          RETURN: <varC> = "VERS #.##"
  2449.  
  2450.            #.## is current COMET revision #
  2451.  
  2452.  
  2453.          PURPOSE:
  2454.          To get the version and revision level of the COMET library in use.
  2455.  
  2456.  
  2457.          EXAMPLE:
  2458.          Version = 'VERS      '
  2459.          CALL COMETMP WITH Version
  2460.          ? 'COMET version in use is: ' + Version
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.                                        - 35 -
  2509.          COMMAND: XRECV
  2510.  
  2511.          ENTRY: <varC> = "XRECV #P,filespec"
  2512.  
  2513.            #P = desired port # (1-5)
  2514.            filespec = complete DOS path\filename
  2515.  
  2516.  
  2517.          RETURN: <varC> = unchanged unless error
  2518.  
  2519.  
  2520.          ERROR CODES:  (See appendix A for general error codes)
  2521.  
  2522.            "xx" = port not OPEN
  2523.            "-"  = busy (file transfer already active)
  2524.  
  2525.          SEE ALSO:  XSEND, FCHK
  2526.  
  2527.  
  2528.          PURPOSE:
  2529.          To start receiving a file using the XMODEM or XMODEM/CRC protocol.
  2530.          XMODEM/CRC is always attempted first with the sender.  Should the
  2531.          sender not support CRC, this command will fall back to the less
  2532.          reliable checksum method of error detection.  Since XRECV operates
  2533.          in the background, use FCHK to determine the status of the file
  2534.          transfer at any time.  Since the XMODEM protocol handles the
  2535.          synchronization of sender and receiver data blocks, no flow
  2536.          control need be specified when the port is OPENed.  Any flow
  2537.          control specified for port is ignored during the file send
  2538.          operation.
  2539.  
  2540.  
  2541.          EXAMPLE:
  2542.          XmdmRecv = 'XRECV #1,C:\MYDIR\MYFILE.EXT'
  2543.          CALL COMETMP WITH XmdmRecv    && Begin receiving file
  2544.          *
  2545.          * Any code here executes at the same time as file is being
  2546.          received
  2547.          *
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.                                        - 36 -
  2575.          COMMAND: XSEND
  2576.  
  2577.          ENTRY: <varC> = "XSEND #1,filespec"
  2578.  
  2579.            #P = desired port # (1-5)
  2580.            filespec = complete DOS path\filename
  2581.  
  2582.          RETURN: <varC> = unchanged
  2583.  
  2584.          ERROR CODES:  (See appendix A for general error codes)
  2585.  
  2586.            "xx" = port not OPEN
  2587.            "-"  = busy (file transfer already active)
  2588.  
  2589.          PURPOSE:
  2590.          To begin sending of a file using the XMODEM protocol.   This
  2591.          command supports both CRC and checksum methods of error detection.
  2592.          The method used will depend on what the receiver requests at the
  2593.          start of the file transfer.  Since this command operates in the
  2594.          background, use FCHK to obtain the file transfer status at any
  2595.          time.  Any flow control settings for this port are ignored as the
  2596.          XMODEM protocol handles sender/receiver synchronization.
  2597.  
  2598.  
  2599.          EXAMPLE:
  2600.  
  2601.          XmdmSnd = 'XSEND #1,\MYDIR\MYFILE.EXT'
  2602.          CALL COMETMP WITH XmdmSnd
  2603.          *
  2604.          * Any code here executes while file is sent
  2605.          *
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.                                        - 37 -
  2641.          COMMAND: YRECV
  2642.  
  2643.          ENTRY: <varC> = "YRECV #P"
  2644.  
  2645.            #P = desired port # (1-5)
  2646.  
  2647.  
  2648.          RETURN: <varC> = unchanged unless error
  2649.  
  2650.          ERROR CODES:  (See appendix A for general error codes)
  2651.  
  2652.            "xx" = port not OPEN
  2653.            "-"  = busy (file transfer already active)
  2654.  
  2655.          PURPOSE:
  2656.          To begin receiving of a file or group of files using the YMODEM
  2657.          batch protocol.  No filename is required as the YMODEM batch
  2658.          protocol includes a filename along with data for each file
  2659.          received.  Any files received will be written to the current
  2660.          directory.  Using YMODEM batch is superior to XMODEM for several
  2661.          reasons.  First, the block size is 1024 bytes in YMODEM versus 128
  2662.          in XMODEM.  This larger block size yields a greater transfer rate
  2663.          than XMODEM.  Secondly, YMODEM batch allows the use of DOS
  2664.          wildcard characters in the filespec parameter.  This means a group
  2665.          of files can be received with one YRECV command, provided that the
  2666.          sender requested multiple files.  Since this command operates in
  2667.          the background, use FCHK to determine the file transfer status at
  2668.          any time.
  2669.  
  2670.  
  2671.          EXAMPLE:
  2672.  
  2673.          YmdmRecv = 'YRECV #1'
  2674.          CALL COMETMP WITH YmdmRecv  && Begin receiving file(s)
  2675.          *
  2676.          * Any code here executes while file(s) are received
  2677.          *
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.          NOTE: If the sender is using some type of a communications package
  2698.          such as XTALK or ProCom, make sure it is configured for and
  2699.          supports the YMODEM batch protocol.  Some packages claim YMODEM
  2700.          capability, yet don't support the batch version.
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.                                        - 38 -
  2707.          COMMAND: YSEND
  2708.  
  2709.          ENTRY: <varC> = "YSEND #P,filespec"
  2710.  
  2711.            #P = desired port # (1-5)
  2712.            filespec = DOS path\filespec
  2713.  
  2714.  
  2715.          RETURN: <varC> = unchanged unless error code
  2716.  
  2717.  
  2718.          ERROR CODES:  (See appendix A for general error codes)
  2719.  
  2720.            "xx" = port not OPEN
  2721.            "-"  = busy (file transfer already active)
  2722.  
  2723.          PURPOSE:
  2724.          To begin sending a file or group of files using the YMODEM batch
  2725.          protocol.  The filespec parameter can include wildcard characters
  2726.          so that more than one file can be sent within a single command.
  2727.          Since this command operates in the background, use FCHK to obtain
  2728.          the file transfer status at any time.
  2729.  
  2730.          EXAMPLE:
  2731.  
  2732.          YmdmSnd = 'YSEND \MYDIR\*.DBF'
  2733.          CALL COMETMP WITH YmdmSnd   && Send all files with DBF extension
  2734.          *
  2735.          * Any code here executes during file send(s)
  2736.          *
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.                                        - 39 -
  2773.                                    TROUBLESHOOTING
  2774.                                   -----------------
  2775.  
  2776.  
  2777.          Problem:
  2778.          After OPENing a port, I can only OUTPUT data to it.  RXCNT and
  2779.          INPUT report 0 characters in buffer:
  2780.  
  2781.          Solution:
  2782.          Verify that your hardware uses the default IRQ# assumed by the
  2783.          OPEN command for COMn.  If you've overridden the default IRQ#,
  2784.          verify its correctness with your serial port's user's manual.
  2785.  
  2786.  
  2787.  
  2788.          Problem:
  2789.          Using ARECV or ASEND, some data is lost during the transfer.
  2790.  
  2791.          Solution:
  2792.          The receiving PC probably cannot keep pace with the sender causing
  2793.          the buffer to overflow.  Use some form of flow control by
  2794.          specifying Xon/xoff or Rts/cts in the OPEN command.
  2795.  
  2796.  
  2797.          Problem:
  2798.          I am trying to get a HAYES modem to dial a phone number by using
  2799.          COMET's OUTPUT command to send it a command string.  The modem
  2800.          never seems to go off hook and dial the number.
  2801.  
  2802.          Solution:
  2803.  
  2804.          1) HAYES modem will abort commands (including dialing) if you
  2805.          OUTPUT anything while they are still processing the original
  2806.          command string you sent.  A general rule of thumb is to wait about
  2807.          1 second between OUTPUTting of modem commands.
  2808.  
  2809.          2) Did your OUTPUT <varC> end with a CHR(13) as required by all
  2810.          HAYES style modems? If not, the modem will just sit there idly.
  2811.  
  2812.  
  2813.  
  2814.          Problem:
  2815.          I am using FoxPro and sometimes my PC hangs when exiting FoxPro to
  2816.          DOS.
  2817.  
  2818.          Solution:
  2819.          Try disabling expanded memory by putting the following statement
  2820.          in your CONFIG.FP file:
  2821.  
  2822.            EMS=OFF
  2823.  
  2824.          This situation occurs very seldom and only when FoxPro loads the
  2825.          COMETMP.BIN file into EMS.  Upon shutdown, FoxPro releases all EMS
  2826.          preventing COMET from doing its own shutdown.  To avoid this
  2827.          problem and still be able to use EMS, simply make sure you CLOSE
  2828.          all COM ports before QUITing from FoxPro.  A future release of
  2829.          COMET will correct this anomaly.
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.                                        - 40 -
  2839.                               APPENDIX A - ERROR CODES
  2840.  
  2841.  
  2842.          After CALLing COMETMP with a character type variable, <varC>,
  2843.          COMETMP will return any error information by replacing the first
  2844.          one or two characters of <varC> with an error code from the
  2845.          following list:
  2846.  
  2847.  
  2848.             CODE      ERROR DESCRIPTION
  2849.             ----      ----------------------------------------------------
  2850.                ?      Command name syntax error. Unknown command requested.
  2851.  
  2852.               ?#      Illegal/missing port #.
  2853.  
  2854.               ?,      Required comma delimiter missing.
  2855.  
  2856.               ??      Command requires parameters but none were found.
  2857.  
  2858.               xx      Port # specified is not currently OPENed.
  2859.  
  2860.                -      Specified port is busy at this time.  Probably due to
  2861.                       a file transfer that is still active.
  2862.  
  2863.               ?l      Bad or missing parameter l.
  2864.                       eg. CALLing COMETMP WITH "OPEN COM8:2400,N,8,1" for
  2865.                       <varC> will return a "?n" error code indicating a bad
  2866.                       parameter n for the OPEN command.
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.                                        - 41 -
  2905.                            Appendix B: Auxilary-Byte Table
  2906.                            -------------------------------
  2907.  
  2908.          Value  Key            Value  Key            Value  Key
  2909.          -----  -------        -----  -------        -----  ---------
  2910.          59     F1             110    Alt-F7         44     Alt-Z
  2911.          60     F2             111    Alt-F8         45     Alt-X
  2912.          61     F3             112    Alt-F9         46     Alt-C
  2913.          62     F4             113    Alt-F10        47     Alt-V
  2914.          63     F5                                   48     Alt-B
  2915.          64     F6             120    Alt-1          49     Alt-N
  2916.          65     F7             121    Alt-2          50     Alt-M
  2917.          66     F8             122    Alt-3
  2918.          67     F9             123    Alt-4          15     Shift-Tab
  2919.          68     F10            124    Alt-5
  2920.                                125    Alt-6          71     Home
  2921.          84     Shift-F1       126    Alt-7          72     Up Arr
  2922.          85     Shift-F2       127    Alt-8          73     PgUp
  2923.          86     Shift-F3       128    Alt-9
  2924.          87     Shift-F4       129    Alt-0          75     Left Arr
  2925.          88     Shift-F5       130    Alt-Hyphen
  2926.          89     Shift-F6       131    Alt-=          77     Right Arr
  2927.          90     Shift-F7
  2928.          91     Shift-F8       16     Alt-Q          79     End
  2929.          92     Shift-F9       17     Alt-W          80     Down Arr
  2930.          93     Shift-F10      18     Alt-E          81     PgDn
  2931.                                19     Alt-R          82     Insert
  2932.          94     Ctrl-F1        20     Alt-T          83     Delete
  2933.          95     Ctrl-F2        21     Alt-Y
  2934.          96     Ctrl-F3        22     Alt-U          114    Ctrl-PrtSc
  2935.          97     Ctrl-F4        23     Alt-I          115    Ctrl-Lft
  2936.          98     Ctrl-F5        24     Alt-O          116    Ctrl-Rgt
  2937.          99     Ctrl-F6        25     Alt-P          117    Ctrl-End
  2938.          100    Ctrl-F7                              118    Ctrl-PgDn
  2939.          101    Ctrl-F8        30     Alt-A          119    Ctrl-Home
  2940.          102    Ctrl-F9        31     Alt-S
  2941.          103    Ctrl-F10       32     Alt-D          132    Ctrl-PgUp
  2942.                                33     Alt-F
  2943.          104    Alt-F1         34     Alt-G
  2944.          105    Alt-F2         35     Alt-H
  2945.          106    Alt-F3         36     Alt-J
  2946.          107    Alt-F4         37     Alt-K
  2947.          108    Alt-F5         38     Alt-L
  2948.          109    Alt-F6
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.                                        - 42 -
  2971.                          Appendix C: CLIPPER EVENT TRAPPING
  2972.                          ----------------------------------
  2973.  
  2974.          Using Clipper's SET KEY n TO procedure command in conjunction with
  2975.          any of COMET's event trapping commands may produce some
  2976.          undesirable side effects.  The problem becomes evident when an
  2977.          ONDCD, ONDONE or ONTIME event occurs during a full screen READ
  2978.          operation.  Clipper detects the keyboard character produced by the
  2979.          ONxxxx event and branches to the SET KEY procedure without a
  2980.          problem.  However, upon RETURNing to the READ's active GET field,
  2981.          the cursor position always gets forced to the field's leftmost
  2982.          (home) position. The cursor would appear to suddenly jump every
  2983.          time an event occurred.  It is recommended that the following code
  2984.          be put inside the SET KEY procedure to alleviate this problem. It
  2985.          takes advantage of the READVAR() parameter that is automatically
  2986.          passed to any SET KEY procedure.
  2987.  
  2988.          PROCEDURE WhatEver
  2989.          PARAMETERS Proc, Line, Var     && Automatically passed
  2990.          *
  2991.          * Place desired event code here
  2992.          *
  2993.  
  2994.          * Cursor fix code
  2995.          IF LEN(Var) > 0               && Is a GET/READ in effect ?
  2996.             PosnInGet = LEN(&Var)      && Determine position
  2997.             * Stuff right arr's to restore this position
  2998.             KEYBOARD REPLICATE(CHR(4), PosInGet)
  2999.          ENDIF
  3000.  
  3001.          RETURN                        && Exit SET KEY procedure
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.                                        - 43 -
  3037.