home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / ntwk_rhr.zip / READ.ME < prev   
Text File  |  1990-08-14  |  4KB  |  71 lines

  1.  Hello Fellow Clarioners,
  2.  I have seen some discussions on various boards and in the Clarion Tech
  3.  Journal to do with reducing the amount of memory required by Designer
  4.  generated applications.  In particular, some have expressed the desire
  5.  to have a model which only opened files as necessary.
  6.  
  7.  Well, I decided to have a go at that one and have created this network
  8.  model to show you the technique.  All my changes are marked with !! and
  9.  the model only contains my changes.  This will allow you to easily identify
  10.  my code so you can try it in your own model files.  Be forwarned that
  11.  this model has not been extensively tested so use at your own risk - If
  12.  you find a problem or can improve on it, let me know.
  13.  
  14.  I have created a new procedure named OpenFile and added it to the map.
  15.  The OpenFile procedure is passed an EXTERNAL filename; the code first
  16.  parses out the path from the filename and then works much like the
  17.  *OPENFILES* code in the Clarion Network.Mdl file.  The *OPENFILES*
  18.  code was modified to do the call to the GENERALIZED OpenFile procedure.
  19.  This technique removes a lot of REDUNDANT code created when you have
  20.  many files.
  21.  
  22.  I have also modified the *TABLE, *REPORT, and a few other sections of
  23.  code with statements like the following:
  24.  
  25.           IF ~Mem:@FileName             !!If File Not Open
  26.             OpenFile(@FileName)         !!  Open The File
  27.           .                             !!.
  28.           Mem:@FileName += 1            !!Increment File Open Count
  29.                       .
  30.                       .
  31.                       .                   <Your Code>
  32.                       .
  33.           IF Mem:@FileName <= 1         !!If Last User of File
  34.             CLOSE(@FileName)            !!  Close The File
  35.             Mem:@FileName = 0           !!  Reset File Open Counter
  36.           ELSE                          !!Otherwise
  37.             Mem:@FileName -= 1          !!  Decrement File Open Counter
  38.           .                             !!.
  39.  
  40.  To make all this work, you must define a field in the MEMORY file for each
  41.  file that you have defined.  This field should be a BYTE type and have an
  42.  initial value of 0 unless you want it opened at startup by the G_OPENFILES
  43.  procedure, in which case it should have a value of 1.  For example, if you
  44.  have three files CUSTOMER, INV_HDR, INV_DTL then you **MUST** define three
  45.  MEM:fields named CUSTOMER, INV_HDR, and INV_DTL.
  46.  
  47.  Thats all there is to it...  However, I should caution you that if you
  48.  do anything in your setup code or elsewhere that would cause Clarion to
  49.  open the file, you should include similar code to that above to insure
  50.  that the files get opened shared.  When you explicitly close a file make
  51.  sure you set Mem:<FileName> = 0.
  52.  
  53.  By the way, if you shell out to dos and the return, the files that were
  54.  open will be reopened properly if you call G_OPENFILES.
  55.  
  56.  As another point - I was looking at Mike Hansons network model and noticed
  57.  a potential problem.  It is with the use of the hard-coded filename
  58.  '#CON#.$$$' for his View_ procedure.  In a network system if two users
  59.  try to view a report on screen at the same time, I believe someone will
  60.  get an error (I haven't verified this).  To avoid conflicts, temporary
  61.  files on a network should have unique names; this could be accomplished
  62.  by someone writing a lem to DOS function 5A to create a temporary file
  63.  or better still use the GET_PID function from my NET1 Lem in the PD section
  64.  as follows for Netware:
  65.  
  66.       ViewFile     DOS,NAME('#CON#.' & FORMAT(Get_Pid(),@N03)).
  67.  
  68.  Regards,
  69.  Randy Rogers
  70.  Proactive Solutions Inc.
  71.