SCOUG-Programming Mailing List Archives
Return to [ 22 | 
October | 
2008 ]
 
 
 
Content Type:   text/plain 
I remain focused on a presentation for the recreation of FORTH.EXE and   
the lesson plan.  I do wish to acknowledge the suggestion, if not   
admonition, of Greg Smith with respect to the approach.  I have   
listened, taken it into account and modified my plans.  While I continue   
that effort intermittently I did want to pursue some issues which will   
enter into the effort.  
 
In software data appears as elements or aggregates of aggregates and   
elements.  In PL/I and in C we have two aggregate forms, the array and   
the structure.  
 
The simplest one-dimensional array is the vector, e.g. "dcl tom (20)   
fixed bin (31);".  This is an array of elements.  We could increase the   
dimensions as in "dcl tom (20, 20) fixed bin (31);" which is an array of   
vectors which in turn is an array of elements. We could continue this   
process indefinitely except we normally and arbitrarily place a fixed   
upper limit of 15 dimensions.  
 
Now the simplest one-dimensional structure consists of elements only as in  
  "dcl 1 susan,  
          2 harry char(4),  
          2 joan fixed dec (7,2),  
          2 jim fixed bin (15);".  
We can also have structures within structures, i.e. multi-dimensional   
structures as in  
"dcl 1 susan,  
          2 harry char(4),  
          2 zippy,  
            3 joan fixed dec (7,2),  
            3 jim fixed bin (15);".  
Now PL/I refers to array aggregates as "homogeneous", meaning all   
elements at each dimension have the same content whereas structure   
aggregates allow each dimension (structure) to have different content,   
i.e. "non-homogeneous or heterogeneous or in APL2 as mixed data.  
 
Now it gets a little complicated when you allow an array of structures   
as in  
dcl 1 susan (12),  
          2 harry char(4),  
          2 zippy,  
            3 joan fixed dec (7,2),  
            3 jim fixed bin (15);".  
or a structure of arrays as in  
dcl 1 susan,  
          2 harry char(4),  
          2 zippy (17),  
            3 joan fixed dec (7,2),  
            3 jim (5) fixed bin (15);".  
 
Now we enter into the "murky" area of aggregate expressions where   
operators act against all elements contained therein.  For arrays like   
"dcl tom (20, 20) fixed bin (31);" where we want to reset its values to   
say zero we can simply write "tom = 0;" which will replace each element   
value with 0.  We can actually do the same with "susan " though harry   
will provide something of a surprise of a character string of three   
blanks followed by a 0.  
 
At this point I will submit an "enhancement" to allow the "null"   
operator to take place.  The "null" operator replaces the value of each   
element with its "identity" value,i.e. that value which remains   
unchanged when operated upon itself.  Thus "tom = 0;" and "tom = null;"   
has the same result whereas in "susan = null;" produces all blanks in   
harry though zeros in both "joan" and "jim".  
 
Now in PL/I if a character variable consists of numeric values only it   
can engage in arithmetic expressions with arithmetic variables.   
Otherwise it will produce a conversion error.  This may not seem   
significant now, but when IBM introduced the S/360 that system no longer   
processed an arithmetic field of blanks as zero as did the 1400 series   
of machines.  This caused IBM to have to expend several millions of   
dollars in writing utilities for COBOL accounts to convert their data   
files into acceptable arithmetic form for processing on the S/360.  For   
PL/I, however, we simply had to add  
	on conv begin;  
	   onsource = '0';  
	end;  
to each program.  When a arithmetic field with blanks occurred the   
conversion exception routine in invoked the conversion on-condition and   
put a character 0 ('0') in the falling position and return it to the   
point of failure for re-execution.  
 
Now our aggregates thus far have one thing in common: they occupy   
contiguous storage.  Thus we need to introduce the list aggregate which   
differs in this respect: its ability to occupy non-contiguous storage.   
That ability also gives it one other advantage, the ability to   
dynamically change its highest (starting) level dimension not available   
to contiguous aggregates.  Moreover it can have zero dimensions at the   
starting level.  Thus it can express zero, one or more results from the   
evaluation of an expression, e.g. an SQL query or in APL a "selection"   
operation against a mixed- or not data array.  
 
We will end this by stating that the application of the null operator   
against a list aggregate results in a null list, one of no entries.   
This allows us to clear the contents of a list aggregate simply as in   
"peter = null;".  We will delve into this in more detail and hopefully   
more fun later.  
 
=====================================================  
 
To unsubscribe from this list, send an email message  
to "steward@scoug.com". In the body of the message,  
put the command "unsubscribe scoug-programming".  
 
For problems, contact the list owner at  
"postmaster@scoug.com".  
 
=====================================================  
 
  
Return to [ 22 | 
October | 
2008 ] 
  
  
The Southern California OS/2 User Group
 P.O. Box 26904
 Santa Ana, CA  92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group.  ALL RIGHTS 
RESERVED. 
 
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International 
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
 
 |