Information Technology Reference
In-Depth Information
You will note that we have a few more structures, one each for the main title,
subheading and the print detail line. Most of this should be familiar and you can take for
granted that I have all the spacing correct. For the main title line we'll print the date in
mm/dd/yy format at the leftmost portion of the line and the page number will be found at
the rightmost portion of the same line, preceded by the literal, Page . The variable
main-heading
is set up to give us all we need. The first new keyword you see is
field ,
which appears to be a variable. It is used mostly for literals or to separate one field from
another. The first occurrence of it is
field character value “/”
and this is one position which is in the third column of the line which will always have a
value of / . It is the separator between the month and day and the day and year in our date.
It occurs twice because we need it twice. We've seen the keyword
value
before. It's used to tell us that this one character field has a specific value. There will be
other uses of the
value
keyword, for literals or constants - fields that don't change. Though
field
is a keyword, we cannot refer to it in our program. For example, we couldn't change its
value. A few lines down you'll see
field character (4) value spaces .
We could have written the statement as
field character (4) value “ ” ,
which we used before. Each of the two statements, as well as
field character (4) value space
achieves the same result - even though one may not be grammatically incorrect. They
represent spaces, a space, nothing, a single blank and blanks.
You will note that
field
occurs a few times in the program and just about each value is different. It represents
either a certain amount of spaces for separation or a specific literal and is part of a
structure, which enables us to use it. If we need to assign it a value that can change, we
have to make it a variable and then we could reference it. Using
field1
or
field2
would do the job, although it would be better to give these fields more meaningful names.
So the beginning of the main title line is a two-character field that is
print-month ,
but as you can tell it has no value. We'll give it one in the program and do the same for
print-day
and
Search WWH ::




Custom Search