BBS: Inland Empire Archive Date: 04-23-92 (08:05) Number: 113 From: MATT HART Refer#: NONE To: DOUGLAS BUNGER Recvd: NO Subj: Multiple Background Color Conf: (2) Quik_Bas
DB> couple days back. Could clear up one thing for me? What is a
DB> named block common rather than a global common parameter?
A named block common, I have recently found out, is VERY
VERY useful in large projects. It allows shared variables
between programs that LINK together, whereas a global
common allows shared variables both between linked programs
and CHAINed programs using a common run time module.
For example, two programs input data. One has a 40 byte field as its
longest, and the other has only 6 bytes (this is a real
situation in many of my programs, and how I use the block
common). In both, I would:
'$INCLUDE:'ACGLOBAL.INC' ' Global COMMON's
In ACGLOBAL, I would have:
COMMON SHARED Highlite
COMMON SHARED Normal
COMMON SHARED CompanyName$
COMMON SHARED CompanyID$
COMMON SHARED Flags()
etc...
Stuff that's needed in all programs
But for each program, I would also have:
' BYTE40.BAS
'$INCLUDE:'ACGLOBAL.INC'
'$INCLUDE:'BYTE40.DEC' ' Block declaration for this program
' only
In BYTE40.DEC:
COMMON SHARED /BYTE40/ Dat() AS STRING * 40
But for BYTE6.DEC:
COMMON SHARED /BYTE6/ Dat() AS STRING * 6
I could NOT use Dat() as a global common and have different
sizes to it. Also, some programs use certain data files,
while others don't. For example, Vendor Update:
'$INCLUDE:'VENTYPE.DEC'
This would have:
TYPE VendorType
Name AS STRING * 25
Address1 AS STRING * 25
etc...
END TYPE
COMMON SHARED /VENTYPE/ VenRec() AS VendorType
COMMON SHARED /VENTYPE/ VenBuf
COMMON SHARED /VENTYPE/ VenRecLen
DECLARE FUNCTION VendorCodes$(VenRec() AS VendorType)
Another program doesn't use the vendor but may use the employee:
'$INCLUDE:'EMPLTYPE.DEC'
TYPE EmployeeType
Name ...
etc...
END TYPE
COMMON SHARED /EMPLTYPE/ EmRec() AS EmployeeType
---
* Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET