Thursday, November 27, 2003, 1:24:53 PM, Jared Still ([EMAIL PROTECTED]) wrote:
JS> The value of part of a string in a file was used to determine what
JS> was in the rest of the string, and where it was.  Very, very ugly.

Back in the day, this sort of thing was done, a lot. It's
ugly when viewed through today's lens of random access disk
files and relational databases. It's defensible, I think, if
you wind the clock back 30 years. I really, really, really
need to work on a book, and then an article, this afternoon,
but let me try to explain, at least a bit. Basically, when
sending data to someone, it was common to generate a tape
with data written sequentially. For example:

    Customer #1
    Order #1
    Lineitem #1
    Lineitem #2
    Lineitem #3
    Order #2
    Lineitem #1
    Lineitem #2
    Customer #2
    Order #1
    Lineitem #1
    etc.

If you think in terms of *sequential* processing, you can
begin to see where this sort of arrangement makes some
amount of sense. You can process all the customers and
orders and lineitems by making one pass through the tape.

On the other hand, if you wrote the tape in the form:

    Customer #1
    Customer #2
    ...
    Order #1 for customer #1
    Order #2 for customer #2
    ...
    Line item #1 for order #1 for customer #1
    ...

Well! Imagine if I handed you this tape and asked you to
generate a report of customers and their orders. You'd need
to unload the tape to disk, break the data into three files,
sort it all, merge it together. Oh, and did I tell you, you
don't have enough disk space to do that.

Government data used to be sent out on tape using many
record formats thrown together into one file. It's not at
all yucky to deal with, but you certainly do *not* want to
apply that same organization to data in a relational
database.

JS> COBOL redefines sound exactly like that, and if so, I stand
JS> by my condemnation.  yuck.

Here's a simple example that might help to illustrate some
of the magic:

01 user-command pic x(20).

01 help-command redefines user-command.
   05 filler   pic x(4).
      88 needs-help value 'help'.
   05 filler   pic x(16).
   
01 display-command redefines user-command.
   05 filler   pic x(7).
      88 display-emp value 'display'.
   05 filler   pic x(x).
   05 display-emp-id pic 99999.
   05 filler   pic x(7).
   
01 print-command redefines user-command.
   05 filler   pic x(5).
      88 print-emp value 'print'.
   05 filler   pic x(x).
   05 print-emp-id pic 99999.
   05 filler   pic x(9).

Given the above, you can now write code like this:

ACCEPT user-command FROM CONSOLE.
IF display-emp THEN
   CALL display-employee USING display-emp-id
ELSE IF print-emp THEN
   CALL print-employee USING print-emp-id
ELSE IF needs-help THEN
   CALL print-some-help.

This may not be the best example, but in this case the
acceptable commands and their formats are driven by
definitions in working-storage. You can easily change from
using 'display 99999' to 'show employee 99999' simply by
tweaking your working-storage definitions.

Best regards,

Jonathan Gennick --- Brighten the corner where you are
http://Gennick.com * 906.387.1698 * mailto:[EMAIL PROTECTED]

Join the Oracle-article list and receive one
article on Oracle technologies per month by 
email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, 
or send email to [EMAIL PROTECTED] and 
include the word "subscribe" in either the subject or body.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Gennick
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to