Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Claude, if else end-if 1

Status
Not open for further replies.

slade

Programmer
Jun 11, 2000
823
US
Claude,

This formatted better:
Code:
 EVAL    WS-AGE  ALSO      TRUE     ALSO    FALSE    
 WHEN 18 THRU 25 ALSO  WS-WT > 200  ALSO    MALE  
      PERFORM 1000-ENROLL-IN-FBALL-PGM
 END-EVAL
  
        EVAL TRUE          ALSO   TRUE
        WHEN WS-AGE < 18   ALSO   WS-AGE > 25
        WHEN WS-WT  < 200  ALSO   ANY
        WHEN NOT MALE      ALSO   ANY
             PERFORM 2000-EXPELL
        END-EVAL

 
hi Slade,
my background is in math. i have a hard time to understand in terms of events.
A=&quot;ws-age between 18 and 25&quot;
B=&quot;ws-wt > 200&quot;
c=&quot;is male&quot;
how would you translate in terms of A, B, C.
Sorry to bother you. I am positive that it would help others
Thanks
 
This would mean A AND B AND NOT C
which means either

the construct is faulty
-OR-
we want to manditorily sign the 18-25 year old women who weigh more than
200 for football

The second construct is interesting as well. It means we want to expel everyone who is

Simultaneously younger than 18 and older than 25
-OR-
Weighs less than 200
-OR-
Is Female

Who will be left if we do both of these???
Betty Scherber
Brainbench MVP for COBOL II
 
Hi Claude,

Sorry I took so long to ans, but I expected you to follow up in your original post, so I didn't look here till now. Luckily Betty did so. See below for a correction.

Hi Betty,

The following
WHEN NOT MALE ALSO ANY
should have been
WHEN MALE ALSO ANY

Then the answer to your question is:

One hell of a female football team. :)

Regards, jack.
 
P.S.
I was wondering what happened to my football team.

Jack
 
hi Slade and Betty,
&quot;WHEN NOT MALE ALSO ANY&quot;, in plain english means &quot;any person, male or not&quot; . this is what i understood in the first place.
is this the right way to use EVAL ?
Eval .... Also True... (or Also False).... End-eval.
Are there restrictions with Eval ?
i think i am going to use it a lot
thanks
 
the only case of Evaluate i encountered till now is
EVALUATE CODE
WHEN &quot;A&quot; PERFORM AA.
WHEN &quot;B&quot; PERFORM BB.
WHEN OTHER PERFORM BAD-CODE.
END-EVALUATE.

 
Hi Claude,
Code:
evaluate   true   also   true
when     not male also    any
     perform 2000-non-male-stuff
end-evaluate
  
Means that 2000-non-male-stuff will be done for any non-male, period. The &quot;any&quot; above means to disregard this &quot;also&quot; test. If the eval read:

evaluate   true   also   true
when       any    also   ws-wt > 200
           perform 3000-sign-up
end-evaluate

then &quot;any person, male or not, weighing more than 200 lbs&quot; 
would be signed up.

BTW, when you see an eval of the form:
      evaluate
      when ...
      when ...
      when ...
      when ...
           perform1 ....
      when ...
           perform2 ...
      when other
           perform3 ... 
      end-evaluate

The stacked &quot;when&quot;s are tested in the order of their appearance until one of them tests as true, then the testing stops and the perform1 (or any other stmt(s) coded) is executed. If none of the &quot;when&quot;s test true the next &quot;when&quot; is tested; if true, perform2 is executed; if false, perform3 is executed. It's good practice to use &quot;when other&quot; in an eval, to guarantee that you account for all cases. Usually it executes an error routine.

Hope this clarifies, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top