Abundance FIGURE 4
( Figure 4 Abundance )
( How Abundance uses Implied subscripts to handle files. )
( This program stores the Names and Birthdates of two )
( dependent children in a standard DOS file allowed to grow )
( big enough to hold up to 15 dependents. )
( Then it prints them out. )
<<<DEFINE
" C:Dep.Dat" ( external file name )
32 ( logical record size in bytes )
( Usually you would leave room )
( for new fields to be added in place )
1 15 <<<SEQ Dependent-Number
( Declare a file with 0 to 15 records )
( indexed 1 .. 15 implicitly by Dependent-Number. )
( Note that the File itself does not have a )
( name. )
30 ULS Child's-Name
1950 01 01 JULIAN ( lower bound )
Today ( upper bound )
MMDDYY Child's-BirthDate
SEQ>>>
DEFINE>>>
<<< SETUP-Dependents
( procedure to initialize the elements of the array )
1 TO Dependent-Number
( as a side effect record 1 is read )
" Bruce" TO Child's-Name
( as a side effect, record 1 is marked Dirty )
( Abundance thus knows to write it sometime later. )
1954 03 26 JULIAN TO Child's-BirthDate
2 TO Dependent-Number
( as a side effect record 1 is written and 2 is read )
1961 07 18 JULIAN TO Child's-BirthDate
" Brock" TO Child's-Name
>>>
<<< PRINT-Dependents
( procedure to print all existing dependents )
EJECT
<<<FOR Dependent-Number
( as a side effect, the appropriate record is read )
WRITE Dependent-Number SPACE Child's-BirthDate 2 SPACES
Child's-Name NL
FOR>>>
EJECT
>>>
<<< DEPEND
( mainline procedure to initialize and print )
SETUP-Dependents
PRINT-Dependents
>>>