Help...college student needs help w/cobol prgm.
Author Message
Help...college student needs help w/cobol prgm.

HELP!!!!!
I am a college student very new to programming.  I have been working on
a program that I have previouly written in C and now need to write in
COBOL.  The program is very simple and is 90% done but I cannot make it
do an average of two values!
Is there someone who might be willing to take a look at it and tell me
why it is not working?  I would be very greatful!
Please e-mail me if you would be good enough to look at it for me!
Thank you!

Wed, 12 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:

> HELP!!!!!
> I am a college student very new to programming.  I have been working on
> a program that I have previouly written in C and now need to write in
> COBOL.  The program is very simple and is 90% done but I cannot make it
> do an average of two values!
> Is there someone who might be willing to take a look at it and tell me
> why it is not working?  I would be very greatful!
> Please e-mail me if you would be good enough to look at it for me!
> Thank you!

( or add a, b giving c)
divide c by 2 giving d      OR

compute average = ( a + b ) / 2

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:

> ( or add a, b giving c)
>         divide c by 2 giving d      OR

> compute average = ( a + b ) / 2

He's probably doing it in integer arithmetic & can't work out whi there's no
fractional part to the average!!!

John

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:

> > HELP!!!!!
> > I am a college student very new to programming.  I have been working on
> > a program that I have previouly written in C and now need to write in
> > COBOL.  The program is very simple and is 90% done but I cannot make it
> > do an average of two values!
> > Is there someone who might be willing to take a look at it and tell me
> > why it is not working?  I would be very greatful!
> > Please e-mail me if you would be good enough to look at it for me!
> > Thank you!

> ( or add a, b giving c)
>         divide c by 2 giving d      OR

> compute average = ( a + b ) / 2

Compute average-value = Function Mean (a b)

(which would also allow a and b to be values in a table - so you could
expand the calculation to)

Compute average-value = Function Mean (each-input-value (all))

--
Bill Klein
wmklein <at> ix dot netcom dot com

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:
> Compute average-value = Function Mean (each-input-value (all))

Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
the average is "34".

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:

> > Compute average-value = Function Mean (each-input-value (all))

> Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
> the average is "34".

Maybe in mathematics (and/or statistics) the MEAN is not the "average" in
this sense, but the following is (verbatim - from the draft of the next
Standard - which does match the current Standard for this) what it says

"The equivalent arithmetic expression shall be as follows:
a) For one occurrence of argument-1,
(argument-1)
b) For two occurrences of argument-1,
((argument-1 sub1 + argument-1 sub2 ) / 2)
c) For n occurrences of argument-1,
((argument-1 sub1 + argument-1sub2 +... + argument-1 subn ) / n)"

(I have used "sub1" "sub2" and "subn" where the text of the Standard uses
subscript.  Unfortunately, actual "subscripts" - of this type - don't show
up well in NGs.)

FYI, if you want a COBOL function that will return "2" from the list (1 2
99), then you need to use the FUNCTION MEDIAN.

--
Bill Klein
wmklein <at> ix dot netcom dot com

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.
there is even something called the harmonic mean (also not supported by
Cobol).
It is the mean obtained by taking the reciprocal of the arithmetic mean of
the
reciprocals of a set of non-zero numbers.

Quote:

> Miller) illuminated comp.lang.cobol thusly:

> > +

> > +
> > +> Compute average-value = Function Mean (each-input-value (all))
> > +
> > +Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
> > +the average is "34".
> > +
> > Oops, yourself. 2 is the *median* of (1,2,99) and 34 is the mean.
> > Average and mean are the same thing.

> FYI, the Cobol function MEAN is the arithmetic mean, which is the same as
> average.  But there is another kind of mean, the geometric mean (which is
> not provided by Cobol).  The geometric mean of 1, 2, and 99 is
> 5.828476683251.
> --
> R B |\  Randall Bart, Pedant

> n r |\  1-614-308-9307      Please reply without spam       I Love You
> d t ||\ Have you solved http://users.aol.com/PanicYr00/Sequence.html ?
> a    |/ MS^7=6/28/107             Let's sing about the Year 2000 Bugs:
> l    |\             http://users.aol.com/PanicYr00/SongMiscellany.html
> l    |/ Has anyone in Washington DC read the US Constitution?

Thu, 13 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

+

+
+> Compute average-value = Function Mean (each-input-value (all))
+
+Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
+the average is "34".
+
Oops, yourself. 2 is the *median* of (1,2,99) and 34 is the mean.
Average and mean are the same thing.

--
dlmiller/at/netdirect/dot/net

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Miller) illuminated comp.lang.cobol thusly:

Quote:

> +

> +
> +> Compute average-value = Function Mean (each-input-value (all))
> +
> +Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
> +the average is "34".
> +
> Oops, yourself. 2 is the *median* of (1,2,99) and 34 is the mean.
> Average and mean are the same thing.

FYI, the Cobol function MEAN is the arithmetic mean, which is the same as
average.  But there is another kind of mean, the geometric mean (which is
not provided by Cobol).  The geometric mean of 1, 2, and 99 is
5.828476683251.
--
R B |\  Randall Bart, Pedant

d t ||\ Have you solved http://users.aol.com/PanicYr00/Sequence.html ?
a    |/ MS^7=6/28/107             Let's sing about the Year 2000 Bugs:
l    |\             http://users.aol.com/PanicYr00/SongMiscellany.html
l    |/ Has anyone in Washington DC read the US Constitution?

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

+there is even something called the harmonic mean (also not supported by
+Cobol).
+It is the mean obtained by taking the reciprocal of the arithmetic mean of
+the
+reciprocals of a set of non-zero numbers.

The original post in this thread requested a method of calculating the
average of a set of numbers. And in statistics the term "mean" is understood
to refer to the arithmetic mean; "mean" by itself *never* refers to either the
harmonic or the geometric mean.
+

+> Miller) illuminated comp.lang.cobol thusly:
+>

+> > +

+> > +
+> > +> Compute average-value = Function Mean (each-input-value (all))
+> > +
+> > +Oops! Average isn't the Mean. Function Mean (1 2 99) is "2" and
+> > +the average is "34".
+> > +
+> > Oops, yourself. 2 is the *median* of (1,2,99) and 34 is the mean.
+> > Average and mean are the same thing.
+>
+> FYI, the Cobol function MEAN is the arithmetic mean, which is the same as
+> average.  But there is another kind of mean, the geometric mean (which is
+> not provided by Cobol).  The geometric mean of 1, 2, and 99 is
+> 5.828476683251.
+> --
+> R B |\  Randall Bart, Pedant

+> n r |\  1-614-308-9307      Please reply without spam       I Love You
+> d t ||\ Have you solved http://users.aol.com/PanicYr00/Sequence.html ?
+> a    |/ MS^7=6/28/107             Let's sing about the Year 2000 Bugs:
+> l    |\             http://users.aol.com/PanicYr00/SongMiscellany.html
+> l    |/ Has anyone in Washington DC read the US Constitution?
+
+

--
dlmiller/at/netdirect/dot/net

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.
Can you use this to double a recipe for a batch of cookies?

--
Michael Mattias
Tal Systems
Racine WI USA

Quote:

>there is even something called the harmonic mean (also not supported by
>Cobol).
>It is the mean obtained by taking the reciprocal of the arithmetic mean of
>the reciprocals of a set of non-zero numbers.

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.

Quote:

> Can you use this to double a recipe for a batch of cookies?
> and others .......

You all got off on this one didn't you ? If Jeff is looking at your
responses you've choked him to death with detail beyond his ken.

My reply to him triggered him sending to me his DEC PC program, which
was complete, and not a come-on where somebody wanted us to do his
homework. Don't believe we should be poring over others code like a
tutor - so rewrote it using NetExpress illustrating how to get the
average. Agreed the average I gave wasn't to sufficient decimal places -
but I doubt very much that's what his tutor was after.

It's important I know, but so many of the messages in this forum get
stuck in the nitty-gritty - all the poor kid wanted was help finishing
off an assignment he had coded.

Jimmy, Calgary AB

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.
I guess I am just amazed at the tangential directions and  velocity
prevalent in this NG.

Heck, just saying  "boo" can generate three weeks of passionate postings...

--
Michael Mattias
Tal Systems
Racine WI USA

Quote:

>You all got off on this one didn't you ? If Jeff is looking at your
>responses you've choked him to death with detail beyond his ken.

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.
Quote:

>You all got off on this one didn't you ? If Jeff is looking at your
>responses you've choked him to death with detail beyond his ken.

>My reply to him triggered him sending to me his DEC PC program, which
>was complete, and not a come-on where somebody wanted us to do his
>homework. Don't believe we should be poring over others code like a
>tutor - so rewrote it using NetExpress illustrating how to get the
>average. Agreed the average I gave wasn't to sufficient decimal places -
>but I doubt very much that's what his tutor was after.

>It's important I know, but so many of the messages in this forum get
>stuck in the nitty-gritty - all the poor kid wanted was help finishing
>off an assignment he had coded.

Poor kid?  I sent him a complete example too ... written in Fujitsu. But
like you, only after I saw his code.  I also wrote him a page of tips about
the code he had written. He did OK by the NG, whatever anyone thinks.
<S>

Fri, 14 Dec 2001 03:00:00 GMT
Help...college student needs help w/cobol prgm.
On Mon, 28 Jun 1999 18:13:59 GMT, "Michael Mattias"

Quote:

>I guess I am just amazed at the tangential directions and  velocity
>prevalent in this NG.

>Heck, just saying  "boo" can generate three weeks of passionate postings...

This is because COBOL programmers - especially those that frequent
this group - have vast, and varied, experience as more than just
programers.  We are analysts.  We analyze everything to death.  Once a
problem is dead, it's easy to code.

All puns intended.

Sat, 15 Dec 2001 03:00:00 GMT

 Page 1 of 2 [ 15 post ]

Relevant Pages