Re: Data Name = to more than one number

docdwarf_at_panix.com
Date: 02/10/04


Date: 10 Feb 2004 12:56:49 -0500

In article <t9GdnW0kV7Sbj7Td4p2dnA@giganews.com>,
JerryMouse <nospam@bisusa.com> wrote:
>docdwarf@panix.com wrote:
>> In article <IIydnQK5-PvJR7XdRVn-ug@giganews.com>,
>> JerryMouse <nospam@bisusa.com> wrote:
>>
>> [snip]
>>
>>> Doing different things based on the value of a single variable is the
>>> defining case for EVALUATE as in:
>>>
>>> EVALUATE ORDER-ITEM-SERIES
>>> WHEN '1' thru '2' (do something)
>>> WHEN '3' thru '4' (do something else)
>>> WHEN '5' CONTINUE (don't do anything)
>>> WHEN OTHER (do error processin)
>>> END-EVALUATE
>>>
>>> You really can't get more clear than that.
>>
>> With all due respect, of course, but 'clarity' is in the mind of the
>> beholder; it has been argued that 88-levels ('conditions') relay the
>> nature of processing to subsequent readers of the code in a manner far
>> superior to the hardcoding used above. Given the example above:
>>
>> 05 ORDER-ITEM-SERIES PIC X VALUE SPACES.
>> 88 VALID-SERIES-VALUE VALUES '1', '2', '3', '4', '5'.
>> 88 ITEMS-PRICED-NORMALLY VALUES '1', '2'.
>> 88 ITEMS-ON-SALE VALUES '3', '4'.
>> 88 ITEMS-DISCOUNTED-OTHER VALUE '5'.
>>
>> ...
>> EVALUATE TRUE
>> WHEN ITEMS-PRICED-NORMALLY
>> PERFORM NORMAL-PRICE-RITUAL THRU NPR-EX
>> WHEN ITEMS-ON-SALE
>> PERFORM SALE-PRICE-RITUAL THRU SPR-EX
>> WHEN ITEMS-DISCOUNTED-OTHER
>> PERFORM OTHER-DISCOUNT-RITUAL THRU ODR-EX
>> WHEN NOT VALID-SERIES-VALUE
>> PERFORM INVALID-ITEM-SERIES THRU IIS-EX
>> END-EVALUATE.
>>
>> (arguments about other aspects of the code given - upper case versus
>> mixed case, PERFORM THRU versus PERFORM, etc. - might best be left to
>> other threads)
>
>You make a good point. However, it must be noted that 88 levels are a
>half-assed attempt at logic and are to be avoided by right-thinkers.

As noted above - ''clarity' is in the mind of the beholder'.
Right-thinkers can, of course, use 88 levels sparingly...

... instead of liberally.

>I say
>"half-assed" because they only address half the logic problem.

Logic, as Wittgenstein tells us, is 'a game played by a particular set of
rules', not some manner of 'one size fits none' paradigm.

>
>For example:
>
>IF TIME-FOR-SUBTOTAL
> PERFORM SUB-TOTAL
> MOVE '0' TO WHITHER-SUBTOTAL <== WTF is "0"?
> END-IF
>
>Really should be:
>IF TIME-FOR-SUBTOTAL
> PERFORM SUB-TOTAL
> MOVE NOT-TIME-FOR-SUBTOTAL TO WHITHER-SUBTOTAL
> END-IF

This, it seems, is more of an argument against hardcoded literals than
against 88 levels; many's the program I've seen with

05 LIT-A PIC X VALUE 'A'.
05 LIT-B PIC X VALUE 'B'.
05 LIT-C PIC X VALUE 'C'.
...
05 LIT-9 PIC X VALUE '9'.

... used similarly.

>
>Even this tastes like a diet softdrink. Much clearer would be the construct:
>
>IF TIME-FOR-SUBTOTAL OF WHITHER-SUBTOTAL
> PERFORM SUB-TOTAL
> MOVE NOT-TIME-FOR-SUBTOTAL TO WHITHER-SUBTOTAL
> END-IF

See above about where clarity exists; a construct you neglect is

05 SUBTOTAL-FLAG PIC X VALUE 'N'.
    88 TIME-FOR-SUBTOTAL VALUE 'Y'.
    88 NOT-TIME-FOR-SUBTOTAL VALUE 'N'.

IF TIME-FOR-SUBTOTAL
    PERFORM SUB-TOTAL
    SET NOT-TIME-FOR-SUBTOTAL TO TRUE
END-IF.

(using SET... TO FALSE is an exercise left to the readers and
standards-writers; for the nonce I shall avoid an attempt to scale such...

... withering heights.)

>
>While your example above is quite clear to most, another complaint I have
>about 88 levels is they emphasise the business logic instead of the data
>logic.

That was, I thought, one of the strengths of COBOL... that a
carefully-crafted chunk o' code could be seen as clear by both a
programmer and ol' Louie in accounting.

>Consider your example rewritten with the following constants:
>
>01 FREE-VIBRATION-FLAG PIC X.
> 88 USE-FLEMING-CONSTANT VALUE '1'.
> 88 RANDOM-WALK VALUE '2'.
> 88 ENTROPY-ADJUSTMENT VALUE '3'.
> 88 PUNCTUATED-EQUILIBRIUM VALUE 'A'.
> 88 JANISSARY VALUE 'J'.
> 88 IGNEOUS VALUE 'F'.
> 88 MONROE-DOCTRINE-REDUX VALUE 'M'.
> 88 LEWINSKY-EFFECT VALUE 'S'.
>
>Who (besides "The Shadow") knows what's afoot?

Someone who is familiar with the language and needs of the business and
the process, a programmer who has spent a few years learning both code and
what the business she works for does...

... oh. Nobody is allowed to do that any more, that's right.

>
>
>This observation, however, comes to you from someone who doesn't use 88
>levels so should probably be ignored. Nothing here, move along.

[DIALECT HUMOR ALERT]

Suuuurrrree, an' whut's all this aboot loit'rrrin' rrround th' strrreets?
P'rrraps me good frrriend, Mr Bill E. Cloob, moight be teachin' ya
somethin' aboot th' meanin' of 'alacrrrity'?

DD



Relevant Pages

  • Re: Devcon Buys Out Coastal Security, Adelphia, & Guardian
    ... > Can't let the Newsletter slide or it loses it's value. ... > alert, keep in mind that if you market to only elderly people, most ... > would be an important source of your business. ...
    (alt.security.alarms)
  • 93rd SILLIMAN UNIVERSITY COMMENCEMENT EXERCISES
    ... Descending to the Top ... One of the questions running in your mind today as you graduate and move ... In the world of business, discipline is defined as work ethic. ... important lessons in life: ...
    (soc.culture.filipino)
  • Re: What do you do?
    ... Yeah, since 1991, I made my living as a strip club DJ and manager. ... partner sold out his shares of the business to his partner. ... Never mind that he started his career in the business as I was ...
    (rec.arts.disney.parks)
  • Re: by-the-way
    ... Don't agree with that - maybe 10 years and in some areas I don't mind ... public health system wonderful and it hasn't cost us personally one single ... The different business and transport laws and taxes every time you cross ... much better to give them an attendance allowance so they will send their ...
    (soc.culture.scottish)
  • Re: When Life Begins
    ... say I think folks should mind their own business in regards to issues ... If I say folksshould mind their own ... or I could sin by inaction. ...
    (alt.smokers.cigars)