HP3000-L Archives

March 1999, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jon Deitch <[log in to unmask]>
Reply To:
Date:
Wed, 3 Mar 1999 22:36:34 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (68 lines)
The main problem is the comparison using a math
comparitor (">").  Your changed code ("NOT EQUAL")
is semantically better than the original.

The difference occurs because the COBOL word "spaces"
gets resolved at COMPILE time, and the compiler is
smart enough to look at AND USE the picture that is
on the left side of the comparison ("new-flag"), which
is: pic x(4).  At compile time the LITERAL " " is simply
encoded as a single space character.

OK, so far we have the compiler producing either one
or four spaces, depending on whether "spaces" or Quote-
space-Quote is used.

Then, to compile "If new-flag > ...." code, the
compiler must choose what it means when 2 non-numeric
values are compared other than for equality and
non-equality.  We generally want it to mean "test
for earlier ("less than") or later ("greater than")
in the sort sequence.  This is not the only reasonable
meaning of the comparison.  It could mean: "greater than"
doesn't make sense, just use equal/not equal.  Or possibly,
"compare the binary values of each item".

Try comparing "new-flag" against a constant in the form:
77 four-spaces  x(4)  values spaces.

If new-flag > four-spaces
    .......

Curt Brimacomb <[log in to unmask]> wrote in message
<[log in to unmask]>:

>I have a question for all you COBOL programmers.  I have run across a
>problem and do not understand why I have to fix it the way I do.
>
>Program(s) worked fine in compatability mode.  Moved to native mode and
>seemed to work fine until new OS update (5.5 pp6) with a new compiler.
>
>Have lines like this:
>77 new-flag pic x(4) value spaces.
>.
>.
>.
>If new-flag > " "
>     move spaces to next-flag.
>
>I now have to change the if line to say 'if new-flag not = spaces'
before it
>will work the same as in compatability mode.  I have also tried 'if
new-flag
>> "    "' but that also does not work correct.
>
>Can someone set me straight on why it no longer works likes it used to?
>
>Curt Brimacomb                             http://www.magiclink.com
>System Manager                             http://www.idahocomputer.net
>Idaho Computer Services, Inc.              http://www.datanow.net
>PO Box 446                                 Voice: (208) 734-2245
>Twin Falls, ID 83301                       Fax: (208) 733-9663
>
>"It is easier to ask a stupid question that it is to fix a stupid
mistake"
>
>
>

ATOM RSS1 RSS2