Re: COBOL "non-myth" confirmed - Index and subscripts (MF on Windows)



On Sun, 23 Sep 2007 02:38:14 -0700, Richard <riplin@xxxxxxxxxxxx> wrote:

On Sep 23, 3:00 pm, Robert <n...@xxxxxx> wrote:
On Sat, 22 Sep 2007 15:47:26 -0700, Richard <rip...@xxxxxxxxxxxx> wrote:
On Sep 22, 6:33 pm, Robert <n...@xxxxxx> wrote:
On Fri, 21 Sep 2007 21:19:15 -0700, Richard <rip...@xxxxxxxxxxxx> wrote:
On Sep 22, 3:15 pm, Robert <n...@xxxxxx> wrote:
On Thu, 20 Sep 2007 18:27:53 -0700, Richard <rip...@xxxxxxxxxxxx> wrote:


Subscripts can be corrupted by using the wrong one, there is no check.
Indexes are 'local', they are tied to a table, in fact tied to an
occurs level, the compiler will tell the programmer when they are
wrongly used.

Unless the compiler has been 'liberalized' to permit that misuse. I just learned here it's
a common extension. I never thought to try it.

It may be an extension in some compilers, notably IBM ones. MF may
allow that extension if the appropriate flags are on, or can be off
for safety. Fujitsu does not have that extension.

It appears to be on by default for MF.

The default for OSVS is NOOSVS, but I don't know if that affects index
usage.

Yeahbut, another default is MF, meaning (on). It's an MF extension.

In my MF manual it has, in the section: Indexing:

"""An index described for some other table can be used instead
provided the two tables have elements of the same size.""" This is
marked OSVS VSC2. It is _NOT_ a MF extension (is isn't marked MF) so
the MF option won't control it.

The online manual says the extension applies under these dialects: OSVS, VSC2 and MF.
It is in section 2.6.5.3 of Language Reference at
http://supportline.microfocus.com/supportline/documentation/books/sx22sp1/lrpubb.htm

However, the default DIALECT is ANS85, not MF.

They mention the "OSVS standard", as though IBM
were in the business of writing standards.

IBM _are_ in the business of writing standards. However, that is not
relevant here as MF are merely acknowledging the standard IBM way for
OSVS. They are not saying it is an ISO, or any other standards body,
standard, only an IBM one.

Every application shop has house 'standards'

So, what was your point ? IBM has 'standard' features in all its
various compilers, this has nothing to do with 'shop standards' or the
'ANS'02 standard'.

When IBM and application shops use the word standard, their intent is to avoid
responsibility for their choices by implying consensus. They want the reader to believe
many companies do things the same way.

Dictionaary definition:
conforming to or constituting a standard of measurement or value; or of the usual or
regularized or accepted kind; "windows of standard width"; "standard sizes"; "the standard
fixtures"; "standard brands"; "standard operating procedure"

We all know that's a lie. Company programming standards are all different from each other.
Sometimes, two departments within the same company have differing standards. In reality,
there is no "usual or regularized or accepted" programming style.

Cobol shop standards are prescriptive, regarded as 'laws' that can never be broken. In
shops using other languages, local standards (if any) are less formal. They are regarded
as descriptive of community norms. The difference is that Cobol standards prohibit
progress, whereas others avoid common mistakes.

Indexes are required for SEARCH.

Only the binary version. One can say VARYING on a serial SEARCH.

So why are you trying to persuade people to revert to 1960s
techniques ? Why do you think you are 'modern' when you are simply
uninformed ?

The modern feature of my argument is that multiply is no longer slow. Indexes would never
have been invented if multiply were as fast as load in the Good Old Days.

No, Robert, the reason that subscripts are, on _some_ systems, at
best, as fast as indexes is because of the optimizer. Multiply is
still not as fast as load.

Your own test results prove you wrong.

No. Wrong. The tests show that the optimizer is able to keep the
result of calculating the address from the subscript for use several
times and thus only do one multiply, which is much the same as the
index where the varying recalculates and it is used several times.

It hasn't magically re-engineered my CPU to make the multiply
instruction as fast as as load instruction, as you wrongly assert, it
has made the number of multiplys fewer than you expected.

You wouldn't say that if you had actually read the code I posted here (twice).
I too ran into that optimization problem. I solved it by putting, inside the loop, code
to make the optimizer think the subscript or index is changing. As a result, multiply (and
store) instructions were not optimized out, as you claim. Here's a sample:

move 'Subscript' to test-name
move 1000 to s-subscript
perform repeat-factor times
if s-subscript = 1000
add 1 to s-subscript
else
subtract 1 from s-subscript
end-if
move array-element (s-subscript) to test-byte
end-perform
.



Relevant Pages

  • Re: COBOL "non-myth" confirmed - Index and subscripts (MF on Windows)
    ... They are not saying it is an ISO, or any other standards body, ... has made the number of multiplys fewer than you expected. ... to make the optimizer think the subscript or index is changing. ... move 1000 to s-subscript ...
    (comp.lang.cobol)
  • AWK code repository request for help (long)
    ... Tim Menzies and I have been talking about an AWK code library system. ... 0c) address of the repository must be in the domain name that corresponds to the chosen name ... formatting standards ... Extension and preprocessor standardization ...
    (comp.lang.awk)
  • Re: how to get 0.000001 with printf?
    ... but still on-topic if we ignore the gcc extension] ... If you examine the grammar in the C Standards, ... operands are both lvalues. ...
    (comp.lang.c)
  • Re: So now I am a spammer?
    ... One of the reasons that individual companies provide proprietary "extensions" to standards is to force you to use their products if you want the extension. ... No web designer should dump a section of their public because they're too lazy to design cross-platform, especially when it's easy to do. ...
    (rec.pets.dogs.behavior)
  • Re: threads / malloc / free / global array
    ... I want to conform to the standards. ... > memory allocation and threads has to be defined by whatever defines ... In my opinion threads are an extension to the OS ...
    (comp.lang.c)