home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
ntwk_rhr.zip
/
READ.ME
< prev
Wrap
Text File
|
1990-08-14
|
4KB
|
71 lines
Hello Fellow Clarioners,
I have seen some discussions on various boards and in the Clarion Tech
Journal to do with reducing the amount of memory required by Designer
generated applications. In particular, some have expressed the desire
to have a model which only opened files as necessary.
Well, I decided to have a go at that one and have created this network
model to show you the technique. All my changes are marked with !! and
the model only contains my changes. This will allow you to easily identify
my code so you can try it in your own model files. Be forwarned that
this model has not been extensively tested so use at your own risk - If
you find a problem or can improve on it, let me know.
I have created a new procedure named OpenFile and added it to the map.
The OpenFile procedure is passed an EXTERNAL filename; the code first
parses out the path from the filename and then works much like the
*OPENFILES* code in the Clarion Network.Mdl file. The *OPENFILES*
code was modified to do the call to the GENERALIZED OpenFile procedure.
This technique removes a lot of REDUNDANT code created when you have
many files.
I have also modified the *TABLE, *REPORT, and a few other sections of
code with statements like the following:
IF ~Mem:@FileName !!If File Not Open
OpenFile(@FileName) !! Open The File
. !!.
Mem:@FileName += 1 !!Increment File Open Count
.
.
. <Your Code>
.
IF Mem:@FileName <= 1 !!If Last User of File
CLOSE(@FileName) !! Close The File
Mem:@FileName = 0 !! Reset File Open Counter
ELSE !!Otherwise
Mem:@FileName -= 1 !! Decrement File Open Counter
. !!.
To make all this work, you must define a field in the MEMORY file for each
file that you have defined. This field should be a BYTE type and have an
initial value of 0 unless you want it opened at startup by the G_OPENFILES
procedure, in which case it should have a value of 1. For example, if you
have three files CUSTOMER, INV_HDR, INV_DTL then you **MUST** define three
MEM:fields named CUSTOMER, INV_HDR, and INV_DTL.
Thats all there is to it... However, I should caution you that if you
do anything in your setup code or elsewhere that would cause Clarion to
open the file, you should include similar code to that above to insure
that the files get opened shared. When you explicitly close a file make
sure you set Mem:<FileName> = 0.
By the way, if you shell out to dos and the return, the files that were
open will be reopened properly if you call G_OPENFILES.
As another point - I was looking at Mike Hansons network model and noticed
a potential problem. It is with the use of the hard-coded filename
'#CON#.$$$' for his View_ procedure. In a network system if two users
try to view a report on screen at the same time, I believe someone will
get an error (I haven't verified this). To avoid conflicts, temporary
files on a network should have unique names; this could be accomplished
by someone writing a lem to DOS function 5A to create a temporary file
or better still use the GET_PID function from my NET1 Lem in the PD section
as follows for Netware:
ViewFile DOS,NAME('#CON#.' & FORMAT(Get_Pid(),@N03)).
Regards,
Randy Rogers
Proactive Solutions Inc.