home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / DMSUDF.ZIP / DMSUDF.DOC next >
Encoding:
Text File  |  1987-08-06  |  14.7 KB  |  426 lines

  1. (c) 1987 D. M. Sampson Consulting
  2.     David M. Sampson, Technical Support
  3.     Data Based Solutions, Inc.
  4.     Publisher of the DATA BASED ADVISOR
  5.  
  6. Documentation for the functions found in the DMS library.  
  7.  
  8.  
  9. FUNCTION:    APPROX
  10.  
  11. SYNTAX:      APPROX(<expC>,<expN>)
  12.  
  13.              expC = the Character expression you want to look for
  14.              expN = the field number your data base file is indexed on
  15.  
  16. DESCRIPTION: APPROX will first attempt a SEEK to find an exact match.if 
  17.  
  18.              one  is  found  then it returns with  the  record  pointer 
  19.  
  20.              looking at the correct record. The same as a straight SEEK
  21.  
  22.              if  the  SEEK is unsuccessful then the  function  returns 
  23.  
  24.              with the record pointer looking at the record which would 
  25.  
  26.              have  been the next record down from the  correct  record 
  27.  
  28.              had it been there.
  29.  
  30.              if  the  search  is  unsuccessful  and  the  record   you 
  31.  
  32.              attempted to find would have been the last record in  the 
  33.  
  34.              data base then the function will return you to the top of 
  35.  
  36.              the file.
  37.  
  38.              Only  Date, Character or Numeric Fields can be used  with 
  39.  
  40.              this  function, if any other type of field  is  specified 
  41.  
  42.              you  will get a Run Time Error: ... and the program  will 
  43.  
  44.              close all databases and abort to the dos prompt.
  45.  
  46.              APPROX  returns  the record number of  the  record  found 
  47.  
  48.              according  to  the description above. You  may  use  this 
  49.  
  50.              record number if you would like but it is not necessary.
  51.  
  52.              CAUTION:  RECORD  NUMBER ONE will be confiscated by  this 
  53.  
  54.                        function  and the information in the key  field 
  55.  
  56.                        will be deleted.
  57.  
  58.                        The  paragraph  above is NOT referring  to  the 
  59.  
  60.                        first  record at the top of the file  according 
  61.  
  62.                        to the index, which you would find by executing 
  63.  
  64.                        the  command GO TOP, this is the actual  Record 
  65.  
  66.                        #1,  which  you  would find  by  executing  the 
  67.  
  68.                        command GOTO 1.
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. FUNCTION:    FILEHERE
  79.  
  80. SYNTAX:      Filehere( <filename>, <expC1>, <expC2>, <exprC3> )
  81.  
  82.              <filename> = The name of the file you want to search for.
  83.  
  84.              <expC>     = 3 available lines of comments to display if
  85.                           the file is not found.
  86.  
  87.  
  88. DESCRIPTION: The filename must include the file extension.
  89.  
  90.              Each  character  expression can be as long as  you  would 
  91.  
  92.              like  but  the function will only display  the  first  50 
  93.  
  94.              characters.  There will be up to 4 lines displayed  if  a 
  95.  
  96.              file  is  not  found, the first line will  be  a  generic 
  97.  
  98.              statement indicating the file name which was searched for 
  99.  
  100.              and  not found.  The 3 you pass will be  displayed  below 
  101.  
  102.              it.
  103.  
  104.              The  message  will  be displayed in  the  middle  of  the 
  105.  
  106.              screen,  will  ask  for a single key  input,  then  after 
  107.  
  108.              hitting a key will disappear returning the screen to what 
  109.  
  110.              it looked like before the message.
  111.  
  112.              FILEHERE returns a .T. if the file was found and a .F. if 
  113.  
  114.              it was not found.
  115.  
  116.  
  117.  
  118. FUNCTION:    PRNTON / PRNTOFF
  119.  
  120. SYNTAX:      Prnton() / Prntoff()
  121.  
  122. DESCRIPTION: The  Prntoff Function simply SETs DEVICE TO SCREEN,  SETs 
  123.  
  124.              PRINT OFF and SETs CONSOLE ON.
  125.  
  126.              The  Prnton  Function  simply  reverses  the  same  three 
  127.  
  128.              commands.
  129.  
  130.              They both return a .T. simply because I couldn't think of 
  131.  
  132.              any thing else to return.
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. FUNCTION:    R2 / R3 / R4
  148.  
  149. SYNTAX:      R2( <exp1>, <exp2N>, <exp3N> )
  150.              R3( <exp1>, <exp2N>, <exp3N>,<exp4N>, <exp5N> )
  151.              R4( <exp1>, <exp2N>, <exp3N>, ... <exp7N> )
  152.  
  153.  
  154.  
  155. DESCRIPTION: The  purpose  of  these functions is  to  permit  Clipper 
  156.  
  157.              arrays to function as multi dimensinal arrays. The Number 
  158.  
  159.              that  is a part of the function name indicates  how  many 
  160.  
  161.              dimensions that functin will similate.
  162.  
  163.              For  the 2 dimensional array the last numeric  expression 
  164.  
  165.              represents  the  total number of elements  in  the  major 
  166.  
  167.              axis.
  168.  
  169.              For   the  3  dimensional  array  the  last   2   numeric 
  170.  
  171.              expressions   represent  the  total  elements   in   each 
  172.  
  173.              respective axis.
  174.  
  175.              For   the  4  dimensional  array  the  last   3   numeric 
  176.  
  177.              expressions   represent  the  total  elements   in   each 
  178.  
  179.              respective axis.
  180.  
  181. EXAMPLE:     Two Dimensional Array:
  182.              store 3  to x,xe    && first level
  183.              store 30 to y,ye    && lowest level
  184.  
  185.              declare arrayname[xe * ye]
  186.  
  187.              ? arrayname[r2(2,25,xe)] displays the value of the
  188.                                       25th position in the 2nd element
  189.  
  190.  
  191.  
  192. EXAMPLE:     Three Dimensional Array:
  193.              store 4  to x,xe
  194.              store 10 to y,ye
  195.              store 8  to z,ze
  196.              declare arrayname[xe * ye * ze]
  197.              ? arrayname[r3(3,9,6,ye,ze)] displays the value in the
  198.                                           6th position of the
  199.                                           9th Y element of the
  200.                                           3rd X element.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212. FUNCTION:    RJUST
  213.  
  214. SYNTAX:      RJUST( <expN1>, <expN2>, <expC> )
  215.  
  216.              <expN1> = Row you want to display your justified message
  217.              <expN2> = The column at which you want the message to be
  218.                        justified.
  219.              <expC>  = The message you want displayed.
  220.  
  221.  
  222. DESCRIPTION: This function displays any message on the screen right
  223.              justified against the <expN2> column.
  224.  
  225. EXAMPLE:     chr1 = 'This message will be justified'
  226.  
  227.              RJUST(23,60,chr1)  && This will display this:
  228.  
  229.                               This message will be justified
  230.                                                            ^
  231.                                                            |
  232.                                              Column #60 ----
  233.  
  234.              RJUST(23,40,chr1) && will diplay this:
  235.  
  236.  
  237.           This message will be justified
  238.                                        ^
  239.                                        |
  240.                            Column #40 --
  241.  
  242.  
  243. FUNCTION:    CENTER
  244.  
  245. SYNTAX:      CENTER( <expN>, <expC> )
  246.  
  247.              <expN> = The row you want to center your message on
  248.              <expC> = The message you want centered
  249.  
  250. DESCRIPTION: CENTER  takes  the expression in <expC> and  displays  it 
  251.  
  252.              centered on row <expN>.
  253.  
  254.              Center assumes an 80 column screen. if you don't have  an 
  255.  
  256.              80 column screen this won't work for you.
  257.  
  258. EXAMPLE:     CENTER(23,chr1) && This will display these on your screen
  259.  
  260.              chr1 = 'This will be centered'
  261.  
  262.                              This will be centered
  263.  
  264.              chr1 = 'This line will also be centered on line 23'
  265.  
  266.                    This line will also be centered on line 23
  267.  
  268.  
  269.  
  270. FUNCTION:    LOOKUP
  271.  
  272. SYNTAX:      LOOKUP( <expC1>, <expC2>, <expN> )
  273.  
  274. DESCRIPTION: LOOKUP  is  normally attached to a VALID clause to  do  an 
  275.  
  276.              automatic 'Lookup' after data input in a GET variable.
  277.  
  278.              LOOKUP saves the current work area, moves to the  workarea 
  279.  
  280.              with the <expC2> alias, does a SEEK on <expC1>.
  281.  
  282.              If the SEEK is successful then the value in  FIELD(<expN>) 
  283.  
  284.              is displayed 2 columns to the right of the GET variable.
  285.  
  286.              If  the  SEEK is unsuccessful then a window  is  displayed 
  287.  
  288.              showing all possible choices and the cursor is placed back 
  289.  
  290.              in the variable waiting for further input.
  291.  
  292.  
  293. EXAMPLE:     Select 0
  294.              use account index code  alias wa_acc
  295.              Select 0
  296.              use transact  alias tran
  297.  
  298.  
  299.              ** The account.dbf has a structure like this:
  300.  
  301.              ACCTCODE   C   4
  302.              ACCTDESC   C  20
  303.  
  304.              @ 23,20 say 'Account Code: ' get acct valid;
  305.  
  306.                                           lookup(acct,'wa_acc',2)
  307.  
  308.              The above source code would move to the WA_ACC work  area, 
  309.  
  310.              do  a  search  with 'acct' (ie the get  variable)  as  its 
  311.  
  312.              expression  and if succesful would display  ACCTDESC  (the 
  313.  
  314.              field data) to the right of the variable ACCT then  return 
  315.  
  316.              to the TRAN workarea
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335. FUNCTION:    IMPLODE / EXPLODE
  336.  
  337. SYNTAX:      EXPLODE( <top>, <lft>, <bot>, <rit>, <inc> )
  338.  
  339.              <top> = the top most row where the window will endup
  340.              <lft> = the left most column where the window will endup
  341.              <bot> = the bottom most row where the window will endup
  342.              <rit> = the right most column where the window will endup
  343.              <inc> = the number of times you want the window to increment
  344.                      as it is growing to its largest size.
  345.  
  346.  
  347. DESCRIPTION: EXPLODE  starts from the center of the anticipated  window 
  348.  
  349.              and grows in an 'exploding' fashion until it grows to  its 
  350.  
  351.              ultimate size.
  352.  
  353.              These  windows  are able to be displayed anywhere  on  the 
  354.  
  355.              screen.
  356.  
  357.              <inc>  can  not  be  0 or you will get  a  'DIVIDE  BY  0' 
  358.  
  359.              message.
  360.  
  361.              IMPLODE  does  the  exact opposite. It  starts  where  the 
  362.  
  363.              window  is  right  now and shrinks it  in  an  'imploding' 
  364.  
  365.              fashion to the center of the window.
  366.  
  367.              The <inc> value in each do not have to be the same.
  368.  
  369. EXAMPLE:     EXPLODE(05,20,19,40,08)
  370.  
  371.              A window will be 'exploded' into position and end up  with 
  372.  
  373.              the upper left hand corner at coordinates (row 5, col  20) 
  374.  
  375.              and  the lower right hand corner at coordinates  (row  29, 
  376.  
  377.              col 40) and it will 'explode' in 08 increments.
  378.  
  379.  
  380.              IMPLODE(10,01,14,78,05)
  381.  
  382.              A  window  will 'implode' (ie shrink)  starting  from  the 
  383.  
  384.              upper left hand corner at coordinates (row 10, col 01) and 
  385.  
  386.              the lower right hand corner being at coordinates (row  14, 
  387.  
  388.              col 78) and will 'implode' in 05 increments.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. FUNCTION:    RESPONSE
  404.  
  405. SYNTAX:      RESPONSE( <expC1>, <expC2>, <expN>, <expC3> )
  406.  
  407.              <expC1> &
  408.              <expC2>  = 2 lines of messages to be displayed
  409.                         they will be displayed on lines 23, 24
  410.              <expN>   = A numeric value for the number of seconds you
  411.                         want the messages to appear.
  412.              <expC3>  = Character string for those keys which are valid
  413.                         responses.
  414.  
  415. DESCREPTION: This function is an enhancement of the dBase WAIT command. 
  416.  
  417.              <expC1>  and <expC2> will both be centered on rows 23  and 
  418.  
  419.              24  respectivly. The messages will stay on the screen  for 
  420.  
  421.              <expN>  real seconds, or until a key is pressed if  <expN> 
  422.  
  423.              equals 0.
  424.  
  425.              Only  those Characters in <expC3> will return a .T., if  a 
  426.  
  427.              key  other  than  those which are a  part  of  <expC3>  is 
  428.  
  429.              pressed this function will return a .F. .
  430.  
  431.              If  you  do not want to specifiy which keys they  have  to 
  432.  
  433.              press replace <expC3> with the string 'ALL' or 'all' (case 
  434.  
  435.              is  ignored) and it will return a .T. no matter  what  key 
  436.  
  437.              they press.
  438.  
  439.              If  <expN> is greater than 0 then <expC3> must be =  'all' 
  440.  
  441.              or  the message will wait <expN> seconds beep and  display 
  442.  
  443.              the message again in an endless loop.
  444.  
  445. EXAMPLE:     chr1 = 'Press one of the following keys'
  446.              chr2 = '(A)bort   (R)etry    (I) dont know what to do!!'
  447.  
  448.              do while .not. RESPONSE(chr1,chr2,0,'ari')
  449.                   ?? chr(07)
  450.              enddo
  451.  
  452.              The the following will be displayed on rows 23 & 24:
  453.  
  454.                         Press one of the following keys
  455.                 (A)bort   (R)etry    (I) dont know what to do!!
  456.  
  457.              this  code will beep once if any key other than a, r or  i 
  458.  
  459.              is pressed then return to the RESPONSE function.
  460.  
  461.              chr1 = 'You have just blown it and if you want to and'
  462.              chr2 = 'don't quit you'll blow it again!!
  463.  
  464.              RESPONSE(chr1,chr2,10,'all')
  465.  
  466.              This code will display the following for 10 real seconds:
  467.  
  468.                  You have just blown it and if you want to and
  469.                        don't quit you'll blow it again!!
  470.  
  471. FUNCTION:    NDEXDISP
  472.  
  473. SYNTAX:      NDEXDISP( <expN>, <expC> )
  474.  
  475.              <expN> = row you want your message to be displayed
  476.              <expC> = the message you want displayed
  477.  
  478.  
  479. DESCRIPTION: One  of the things wrong with commands like INDEX,  DELETE 
  480.  
  481.              and REINDEX is that they take over and you have no control 
  482.  
  483.              over  the diplay or how and when to quit in the middle  of 
  484.  
  485.              one  of their runs, well, thanks to Nantucket  those  days 
  486.  
  487.              are  over.  All  you  have to do  is  attach  this  little 
  488.  
  489.              function onto the index expression as one of the  elements 
  490.  
  491.              (or  onto one of the DELETE FOR/WHILE conditions) and  you 
  492.  
  493.              will be able to display all of what you want and even more 
  494.  
  495.              during  any  of those command processes. This  even  works 
  496.  
  497.              with many other commands.
  498.  
  499.  
  500. EXAMPLE:     chr1 = 'Indexing Record #'
  501.              index on lastname+frstname+NDEXDISP(24,chr1) to name.ntx
  502.  
  503.              During  the index processing on row #24 you will see  this 
  504.  
  505.              displayed on your screen.
  506.  
  507.              Indexing Record # <cur_rec#> of <total records>
  508.  
  509.              <cur_rec#> will race through displaying each record number 
  510.  
  511.              as it progresses.
  512.  
  513.              <total  records> will constantly display the  same  number 
  514.  
  515.              which will be equivilant to the total records in the  data 
  516.  
  517.              base.
  518.  
  519.              Each  time  the  index  file  is  accessed  this  will  be 
  520.  
  521.              displayed, even after the actual indexing is finished.  In 
  522.  
  523.              other  words  if  you REINDEX, SEEK,  FIND  or  PACK  this 
  524.  
  525.              message will show up on line #24 (or what ever number  you 
  526.  
  527.              set)
  528.