Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Compile error
Can someone help?  I have coded this and can't figure out why I get an error
:

BONUS-PROCESS.
DIVIDE SAL-SLD-P BY SAL-ASKING-P GIVING SAL-PO-ASKING.
MULTIPLY 100 BY SAL-PO-ASKING.
EVALUATE SAL-PO-ASKING
WHEN SAL-PO-ASKING >= 95
MULTIPLY SAL-SLD-P BY .05 GIVING SAL-COMM-PAID
COMPUTE SAL-BONUS = (SAL-SLD-P - (SAL-ASKING-P * .95)) * .4
ADD SAL-BONUS TO SAL-COMM-PAID
WHEN SAL-PO-ASKING >= 94
MULTIPLY SAL-SLD-P BY .045 GIVING SAL-COMM-PAID
WHEN SAL-PO-ASKING >= 93
MULTIPLY SAL-SLD-P BY .04 GIVING SAL-COMM-PAID
WHEN SAL-PO-ASKING >= 92
MULTIPLY SAL-SLD-P BY .035 GIVING SAL-COMM-PAID
WHEN SAL-PO-ASKING >= 91
MULTIPLY SAL-SLD-P BY .03 GIVING SAL-COMM-PAID
WHEN SAL-PO-ASKING >= 90
MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
WHEN OTHER
MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
COMPUTE SAL-PENALTY = (SAL-ASKING-P * .95) - SAL-SLD-P
SUBTRACT SAL-PENALTY FROM SAL-COMM-PAID
END-EVALUATE.

It appears to have a problem with the numeric literals 95-90.  The exact
compile error I get is:
E  Selection object or THROUGH/THRU invalid; found '95'

and it says the same thing for 94-90.  Any ideas?

KL

Report this thread to moderator Post Follow-up to this message
Old Post
KL
03-27-04 03:59 AM


Re: Compile error
You don't tell us compiler - but what you are doing is valid as a Micro Focu
s
extension - or in the 2002 ISO COBOL Standard - but *not* in a "strictly" '8
5
Standard compiler.  You are using a "partial expression" in your when clause
,
i.e. a clause that starts with a relational operator.  It is valid to code:

Evaluate A
When B
..
When C thru D

***
but it is NOT valid to code

Evaluate A
When > B
...
When = C

***

You can code
Evaluate True
When A > B
..
When A = C

***

Does this make the problem clear?

--
Bill Klein
wmklein <at> ix.netcom.com
"KL" <klbjornme@aol.comjunkhell> wrote in message
news:20040313233938.02537.00003479@mb-m23.aol.com...
> Can someone help?  I have coded this and can't figure out why I get an err
or:
>
>  BONUS-PROCESS.
>      DIVIDE SAL-SLD-P BY SAL-ASKING-P GIVING SAL-PO-ASKING.
>      MULTIPLY 100 BY SAL-PO-ASKING.
>      EVALUATE SAL-PO-ASKING
> WHEN SAL-PO-ASKING >= 95
>     MULTIPLY SAL-SLD-P BY .05 GIVING SAL-COMM-PAID
>     COMPUTE SAL-BONUS = (SAL-SLD-P - (SAL-ASKING-P * .95)) * .4
>     ADD SAL-BONUS TO SAL-COMM-PAID
> WHEN SAL-PO-ASKING >= 94
>     MULTIPLY SAL-SLD-P BY .045 GIVING SAL-COMM-PAID
> WHEN SAL-PO-ASKING >= 93
>     MULTIPLY SAL-SLD-P BY .04 GIVING SAL-COMM-PAID
> WHEN SAL-PO-ASKING >= 92
>     MULTIPLY SAL-SLD-P BY .035 GIVING SAL-COMM-PAID
> WHEN SAL-PO-ASKING >= 91
>     MULTIPLY SAL-SLD-P BY .03 GIVING SAL-COMM-PAID
> WHEN SAL-PO-ASKING >= 90
>     MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
> WHEN OTHER
>     MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
>     COMPUTE SAL-PENALTY = (SAL-ASKING-P * .95) - SAL-SLD-P
>     SUBTRACT SAL-PENALTY FROM SAL-COMM-PAID
>      END-EVALUATE.
>
> It appears to have a problem with the numeric literals 95-90.  The exact
> compile error I get is:
> E  Selection object or THROUGH/THRU invalid; found '95'
>
> and it says the same thing for 94-90.  Any ideas?
>
> KL



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
03-27-04 03:59 AM


Re: Compile error
KL wrote:
> Can someone help?  I have coded this and can't figure out why I get an err
or:
>
>  BONUS-PROCESS.
>      DIVIDE SAL-SLD-P BY SAL-ASKING-P GIVING SAL-PO-ASKING.
>      MULTIPLY 100 BY SAL-PO-ASKING.
>      EVALUATE SAL-PO-ASKING
> 	WHEN SAL-PO-ASKING >= 95
> 	    MULTIPLY SAL-SLD-P BY .05 GIVING SAL-COMM-PAID
> 	    COMPUTE SAL-BONUS = (SAL-SLD-P - (SAL-ASKING-P * .95)) * .4
> 	    ADD SAL-BONUS TO SAL-COMM-PAID
> 	WHEN SAL-PO-ASKING >= 94
> 	    MULTIPLY SAL-SLD-P BY .045 GIVING SAL-COMM-PAID
> 	WHEN SAL-PO-ASKING >= 93
> 	    MULTIPLY SAL-SLD-P BY .04 GIVING SAL-COMM-PAID
> 	WHEN SAL-PO-ASKING >= 92
> 	    MULTIPLY SAL-SLD-P BY .035 GIVING SAL-COMM-PAID
> 	WHEN SAL-PO-ASKING >= 91
> 	    MULTIPLY SAL-SLD-P BY .03 GIVING SAL-COMM-PAID
> 	WHEN SAL-PO-ASKING >= 90
> 	    MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
> 	WHEN OTHER
> 	    MULTIPLY SAL-SLD-P BY .025 GIVING SAL-COMM-PAID
> 	    COMPUTE SAL-PENALTY = (SAL-ASKING-P * .95) - SAL-SLD-P
> 	    SUBTRACT SAL-PENALTY FROM SAL-COMM-PAID
>      END-EVALUATE.
>
> It appears to have a problem with the numeric literals 95-90.  The exact
> compile error I get is:
> E  Selection object or THROUGH/THRU invalid; found '95'
>
> and it says the same thing for 94-90.  Any ideas?
>
> KL


Your sytax is wrong ...

evaluate sal-po-asking
when >= 95
blah
when >= 94
blah blah
when >= 93
etc etc

Donald





Report this thread to moderator Post Follow-up to this message
Old Post
Donald Tees
03-27-04 03:59 AM


Re: Compile error
"Donald Tees" <donald_tees@nospam.sympatico.ca> wrote in message
news:1MX4c.9$Q16.2532@news20.bellglobal.com...
> KL wrote: 
error: 
> Your sytax is wrong ...
>
> evaluate sal-po-asking
> when >= 95
> blah
> when >= 94
> blah blah
> when >= 93


But you could...

Evaluate true
when sal-po-asking >=95

when sal-po-asking >=94     'by the way the greater than is moot here

...

MCM






Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
03-27-04 03:59 AM


Re: Compile error
In article <of_4c.34307$PY.23991@newssvr26.news.prodigy.com>, "Michael Matti
as"
<michael.mattias@gte.net> writes:

>"Donald Tees" <donald_tees@nospam.sympatico.ca> wrote in message
>news:1MX4c.9$Q16.2532@news20.bellglobal.com... 
>error: 
>
>
>But you could...
>
> Evaluate true
>     when sal-po-asking >=95
>
>     when sal-po-asking >=94     'by the way the greater than is moot here
>
>...
>
>MCM

Why is the greater that moot here?  What would happen if I just used = and t
he
value turned out to be 94.5?  Just wondering.

KL

Report this thread to moderator Post Follow-up to this message
Old Post
KL
03-27-04 03:59 AM


Re: Compile error
In article <1MX4c.9$Q16.2532@news20.bellglobal.com>, Donald Tees
<donald_tees@nospam.sympatico.ca> writes:

>KL wrote: 
>error: 
>
>
>Your sytax is wrong ...
>
>	evaluate sal-po-asking
>	 when >= 95
>		blah
>	 when >= 94
>		blah blah
>	 when >= 93
>                 etc etc
>
>Donald

I tried that and got errors, so I added in that part thinking it was the
problem.  Will take out and try again.

KL

Report this thread to moderator Post Follow-up to this message
Old Post
KL
03-27-04 03:59 AM


Re: Compile error
Actually, I don't know what compiler I am using.  This is for a class and we
use RED for editor, I think we use REALCOB for the compiler, but not sure if
that makes any sense to you all.

KL

In article <X2T4c.19905$%06.915@newsread2.news.pas.earthlink.net>, "William 
M.
Klein" <wmklein@nospam.netcom.com> writes:

>You don't tell us compiler - but what you are doing is valid as a Micro Foc
us
>extension - or in the 2002 ISO COBOL Standard - but *not* in a "strictly" '
85
>Standard compiler.  You are using a "partial expression" in your when claus
e,
>i.e. a clause that starts with a relational operator.  It is valid to code:
>
>  Evaluate A
>     When B
>          ...
>      When C thru D
>
>***
>but it is NOT valid to code
>
>   Evaluate A
>      When > B
>         ....
>        When = C
>
>***
>
>You can code
>     Evaluate True
>         When A > B
>             ...
>          When A = C
>
>***
>
>Does this make the problem clear?
>
>--
>Bill Klein
> wmklein <at> ix.netcom.com
>"KL" <klbjornme@aol.comjunkhell> wrote in message
>news:20040313233938.02537.00003479@mb-m23.aol.com... 
>error: 
>



Report this thread to moderator Post Follow-up to this message
Old Post
KL
03-27-04 03:59 AM


Re: Compile error
Donald Tees wrote:
>
>
> Your sytax is wrong ...
>
> evaluate sal-po-asking
> when >= 95
> blah
> when >= 94
> blah blah
> when >= 93
>                  etc etc
>

Nah, can't use ">=" after a "when" if evaluating a data-name

You can, however:

EVALUATE SAL-PO-ASKING
WHEN 95 THRU 10000 *> or some other arbitrarily large number
blah
WHEN 94 THRU 10000
blah2
WHEN 92.5 THRU 10000
blah3
etc.



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
03-27-04 03:59 AM


Re: Compile error
On Sun, 14 Mar 2004 11:55:34 -0600, "JerryMouse" <nospam@bisusa.com>
wrote:

>Donald Tees wrote: 
>
>Nah, can't use ">=" after a "when" if evaluating a data-name
>
>You can, however:
>
>EVALUATE SAL-PO-ASKING
>  WHEN 95 THRU 10000 *> or some other arbitrarily large number
>      blah
>  WHEN 94 THRU 10000
>      blah2
>  WHEN 92.5 THRU 10000
>      blah3
>   etc.
>

Which will not work if sal-po-asking = 20000

Better to code

EVALUATE TRUE
WHEN SAL-PO-ASKING >= 95
PERFROM THIS
WHEN SAL-PO-ASKING >_ 96
PERFORM THAT
etc

WHEN OTHER
PERFORM SOMETHING-ELSE
END-EVALUATE






--
With kind Regards            |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,
Volker Bandke               |,4-  ) )-,_. ,\ (  `'-'
(BSP GmbH)                '---''(_/--'  `-'\_)

Doubt is not a pleasant condition, but certainty is absurd. -- Voltaire

(Another Wisdom from my fortune cookie jar)

Report this thread to moderator Post Follow-up to this message
Old Post
Volker Bandke
03-27-04 03:59 AM


Re: Compile error
Volker Bandke wrote:
> On Sun, 14 Mar 2004 11:55:34 -0600, "JerryMouse" <nospam@bisusa.com>
> wrote:
> 
>
> Which will not work if sal-po-asking = 20000

Good catch! I should have said:

EVALUATE SAL-PO-ASKING
WHEN 95 THRU 20001 *> or some other arbitrarily large number
blah
WHEN 94 THRU 20001
blah2
WHEN 92.5 THRU 2001
blah3
etc.



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
03-27-04 03:59 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 11:35 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.