Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit on number of lines in a .prg file for db IV?

Status
Not open for further replies.

ddelk

Programmer
May 28, 2003
47
US
I have looked through the documentation and can find nothing to say how many lines of code a .prg can be, nor any limits on the compiler. Does anyone know if there are any?
 
I don't recall ever seeing anything on the limitation of a PRG. I've always used a text editor (not the MODI COMM that was packaged with db), and I tend to break up the procedures into seperate modules.

Not sure about the compiler though.

--MiggyD
 
Thanks, I'm still researching it but so far nothing.
 
I seem to recall that in a version (not sure which one) before dBase 5 for DOS the limit was 64KB for a PROCEDURE (.PRG) file, but no current size limit mentioned in this book. The dBase 5 book says the procedure file can hold up to 963 procedures, and procedure names are unlimited in length but only the first 9 characters are used.

File names: DOS 8.3 style
procedure or function names: 9 chars
fields and memory variables: 10 chars

It also recommends that the PRG filename not match any internal procedure name within the file, but I've never seen that cause an error, must be their idea of "good programming". We have dozens of PRGs each with many procedures and functions. Since version 5 only allows one procedure file assignment in SET PROCEDURE TO, we name the main routine in each PRG the same as the filename, that way we end up having several PRGs open at one time in some instances, more flexible.

Also, if you have some routines that must ALWAYS be available, then dBase 5 has a special command line that you can put into the config.db file so that every time dBase is run, that file is opened upon startup and every procedure and function inside it is available all the time. So in effect, you can have it as well as a procedure file set, besides calling other PRGs on-the-fly. Example in config.db:

Code:
SYSPROC = C:\DB_PROCS\DB_AVAIL.DBO

Be aware that functions in dBase 5 have certain limits and restrictions, unlike FoxPro where they are quite similar in capabilities. For example, a dBase 5 function cannot close a table that was open when it was called.
 
There was never a limitation on the number of characters in a PROGRAM (PRG) file. As dbMark pointed out, dBase III+'s internal editor had a limit of characters it could display - not sure what the value was - but if an external text editor was used, there was no limit.

There's always a better way...
 
I must have been thinking of the old DOS file structures...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top