IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

EVALUATE going in wrong WHEN condition


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Mon Mar 22, 2010 5:24 pm
Reply with quote

My code is :
Code:

EVAUATE TRUE ALSO TRUE ALSO TRUE
WHEN
        A=B ALSO
        C=D ALSO
        E=F   
        MOVE A TO F
WHEN...
.....
...
END-EVALUATE



My code is not working properly. It is going in wrong WHEN condition.

Thanks....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 22, 2010 5:35 pm
Reply with quote

How do you know it is going to the wrong WHEN statement? To prove this, you need to DISPLAY the values of A, B, C, D, E, and F before the EVALUATE statement and show us the values (and the full EVALUATE). And you should be aware that moving A to F in your WHEN statement will have absolutely no impact upon the EVALUATE -- if the first WHEN triggers, the next statement to be executed will be END-EVALUATE.
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 8:52 am
Reply with quote

Code:

EVALUATE TRUE ALSO TRUE ALSO TRUE

WHEN   A= SPACE ALSO
            B = SPACE ALSO
            C = SPACE
            SET WS-COND1 TO TRUE

WHEN   A NOT = SPACE ALSO
            B = SPACE ALSO
            C = SPACE
            SET WS-COND2 TO TRUE

WHEN   A = SPACE ALSO
            B NOT = SPACE ALSO
            C = SPACE
            SET WS-COND3 TO TRUE
..............................
END-EVALUATE.


In this way I need to validate 3 fields with spaces for all possible combinations (i.e. 8 cases).
My query is: do I need to put these conditions in when clause in single line? I am asking this because in all examples and in the standard IBM syntax manual it is given in that way.

The code is not working properly when I am testing it in XPED.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Mar 23, 2010 9:48 am
Reply with quote

Hello,

Quote:
My query is: do I need to put these conditions in when clause in single line?
No. Not that i'm aware of. Besides, the length may exceed one line.

You do however need to post the actual code, some sample data values, and what you see in xped when you run the code with that sample data.
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 9:56 am
Reply with quote

thanks Dick..!

Then is it using of NOT in when clause affecting the result of EVALUATE condition?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Mar 23, 2010 10:17 am
Reply with quote

Hello,

Quote:
Then is it using of NOT in when clause affecting the result of EVALUATE condition?
It should, but we can all be more sure when you post the requested info. . . What you have posted is confusing as it is "alphabet soup" and we (people) work better with "real" fields and data.

To repeat:
Quote:
You do however need to post the actual code, some sample data values, and what you see in xped when you run the code with that sample data.
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Tue Mar 23, 2010 10:29 am
Reply with quote

Hi Abdul,

Giving the WHEN is seperate lines also is not any issue. I dont think giving 'NOT =' also would be a problem.

Pls explain the issue....
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Mar 23, 2010 11:24 am
Reply with quote

Hi Abdul,

I have tested the same here and the output looks satisfactory for me...

Code:
 WORKING-STORAGE SECTION.                     
 01  WS-WORKING-VARIABLES.                   
     05  WS-WORK-A               PIC X(01).   
     05  WS-WORK-B               PIC X(01).   
     05  WS-WORK-C               PIC X(01).   
     05  WS-COND-VAR.                         
         10  WS-WORK-1           PIC X(01).   
         10  WS-WORK-2           PIC X(01).   
         10  WS-WORK-3           PIC X(01).   
         10  WS-WORK-4           PIC X(01).   
*                                             
 PROCEDURE DIVISION.                         
*                                             
 MAIN-LINE-PARA.                                   
*                                                   
     MOVE SPACES          TO WS-WORK-A             
                             WS-WORK-B             
                             WS-WORK-C.             
     INITIALIZE WS-COND-VAR.                       
*                                                   
     PERFORM VALIDATE-PARA THRU VALIDATE-PARA-EXIT.
     DISPLAY WS-COND-VAR.                           
*                                                   
     MOVE 'X'             TO WS-WORK-A.             
     MOVE SPACES          TO WS-WORK-B             
                             WS-WORK-C.             
     INITIALIZE WS-COND-VAR.                       
*                                                   
     PERFORM VALIDATE-PARA THRU VALIDATE-PARA-EXIT.
     DISPLAY WS-COND-VAR.                           
*                                                   
     MOVE SPACES          TO WS-WORK-A               
                             WS-WORK-C.             
     MOVE 'X'             TO WS-WORK-B.             
     INITIALIZE WS-COND-VAR.                         
*                                                   
     PERFORM VALIDATE-PARA THRU VALIDATE-PARA-EXIT. 
     DISPLAY WS-COND-VAR.                           
*                                                   
     MOVE 'X'             TO WS-WORK-A               
                             WS-WORK-B               
                             WS-WORK-C.             
     INITIALIZE WS-COND-VAR.                         
*                                                   
     PERFORM VALIDATE-PARA THRU VALIDATE-PARA-EXIT. 
     DISPLAY WS-COND-VAR.                           
*                                                   
     STOP RUN.                                       
*                                                   
 VALIDATE-PARA.                           
     EVALUATE TRUE ALSO TRUE ALSO TRUE   
     WHEN WS-WORK-A = SPACE ALSO         
          WS-WORK-B = SPACE ALSO         
          WS-WORK-C = SPACE               
          MOVE '1'        TO WS-WORK-1   
     WHEN WS-WORK-A NOT = SPACE ALSO     
          WS-WORK-B = SPACE ALSO         
          WS-WORK-C = SPACE               
          MOVE '2'        TO WS-WORK-2   
     WHEN WS-WORK-A = SPACE ALSO         
          WS-WORK-B NOT = SPACE ALSO     
          WS-WORK-C = SPACE               
          MOVE '3'        TO WS-WORK-3   
     WHEN OTHER                           
          MOVE '4'        TO WS-WORK-4   
     END-EVALUATE.                       
*                                         
 VALIDATE-PARA-EXIT.     
     EXIT.               
*                         
Output
Code:
1         
 2       
  3       
   4     


Please do let us know if there is anything wrong in the sample I have tried.. icon_smile.gif
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 11:54 am
Reply with quote

Binop,
This is exactly equal to what my scenario is. But still its not working properly for me. icon_sad.gif

I tried with the IF ELSE logic as well, in this case also it is not working. I changed the data many times, the data looks good, but still the problem persists.

Do you have any suggestions?
Do you think SPACES and SPACE will make a difference?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Mar 23, 2010 11:59 am
Reply with quote

Quote:
Do you think SPACES and SPACE will make a difference?
No...

Quote:
Do you have any suggestions?
Yes... Provide the info what Dick has asked... It would make our life much easier if we could see your actual code along with the DISPLAY statements you have used to do the verification.... and since you have mentioned even IF .. ELSE-IF .. is also not working... my assumption is data problem..
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 12:12 pm
Reply with quote

Code:

 --------------------- XPEDITER/CICS - SOURCE LISTING (2.L) ----------------GD1D
 COMMAND ===>                                                   SCROLL ===> CSR
 MODULE: CMOCTMZ1    ****** STATEMENT 002348 EXECUTED         STEP=00001 *******
    LV ---- COBOL DATANAME KEEPS ---- -- ATTRIBUTES -- ----+---10----+---20--->
 K  03 WS-TODO-ITEM-CDE               X(10)            ITEM567890               
 K  03 WS-TODO-ITEM-LVL-CDE           X(10)            LVLCDE7890               
 K  03 WS-TODO-PROC-CDE               X(03)            PRO                     
    02 WSF-FUNCTION                   X(08)            READ0003                 
    88 WSF-UPDATE6                    VALUE            UPDATE06                 
 ------   ---------------------------------------------- Before CMOCTMZ1.2352 ->
 002345                                                                         
 002346   ********START*********                                               
 002347        EVALUATE TRUE ALSO TRUE ALSO TRUE                               
 002348            WHEN                                                         
 002349               WS-TODO-ITEM-CDE     = SPACE      ALSO                   
 002350               WS-TODO-ITEM-LVL-CDE = SPACE      ALSO                   
 002351               WS-TODO-PROC-CDE     = SPACE                             
 =====>               SET WSF-UPDATE6  TO TRUE                                 
 002353   *           MOVE SPACES      TO ZUT33O-PITM-CDE                       
 002354   *           MOVE SPACES      TO ZUT33O-PITM-LVL-CDE                   
 002355   *           MOVE SPACES      TO ZUT33O-MSTR-PROCESS-TYPE             
 002356            WHEN                                                         
 002357               WS-TODO-ITEM-CDE     NOT = SPACE ALSO                     
 002358               WS-TODO-ITEM-LVL-CDE = SPACE      ALSO   


as you can see here: the values are not spaces but still it is going in the WHEN cond where it is saying all flds are spaces..

Please advice
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Mar 23, 2010 1:02 pm
Reply with quote

icon_eek.gif
I got to say I am baffled...

Abdul, would like to know one information... Would like to know where the control is going from there...

its been sometime since I have worked in Xpediter... but I have a vague memory that even though the cursor is showing in SET statement, like in your case, its acutally executing the WHEN statement... I could be very well wrong... but you could just check... icon_cool.gif

Posting the whole EVALUATE statment might also help... ... icon_biggrin.gif
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 1:08 pm
Reply with quote

Quote:
Would like to know where the control is going from there...


After setting that flag, its going to END-EVALUATE.
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Mar 23, 2010 4:02 pm
Reply with quote

I am sorry guys...! icon_sad.gif

It was a mistake from my side....

In the XPED I was skipping some code prior to this EVALUATE, which was causing this issue.

Now its working fine.. icon_biggrin.gif
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Mar 24, 2010 5:53 pm
Reply with quote

Ok Abdul,

I would suggest an alternative way of writing the EVALUATE statment in question, eliminating all the negated WHEN expressions:
Code:
VALIDATE-PARA.                           
     EVALUATE WS-WORK-A = SPACE ALSO
              WS-WORK-B = SPACE ALSO
              WS-WORK-C = SPACE
     WHEN TRUE ALSO TRUE ALSO TRUE               
          MOVE '1'        TO WS-WORK-1   
     WHEN FALSE ALSO TRUE ALSO TRUE     
          MOVE '2'        TO WS-WORK-2   
     WHEN TRUE ALSO FALSE ALSO TRUE         
          MOVE '3'        TO WS-WORK-3   
     WHEN OTHER                           
          MOVE '4'        TO WS-WORK-4   
     END-EVALUATE.                       
*                                         
 VALIDATE-PARA-EXIT.     
     EXIT.

You can actually implement your decision table directly that way.
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Sat Mar 27, 2010 6:41 pm
Reply with quote

Code:

EVALUATE TRUE
     WHEN WS-WORK-A     = SPACE and WS-WORK-B     = SPACE and WS-WORK-C = SPACE               
          MOVE '1'   TO ...
     WHEN WS-WORK-A NOT = SPACE and WS-WORK-B     = SPACE and WS-WORK-C = SPACE               
          MOVE '2'   TO  ... 
     WHEN WS-WORK-A     = SPACE and WS-WORK-B NOT = SPACE and WS-WORK-C = SPACE               
          MOVE '3'   TO  ... 
     WHEN OTHER                           
          MOVE '4'   TO  ... 
END-EVALUATE.                       


Hi,
Is there any reason not to use the code above? Is the original code posted (with the "also" option) more efficient than this?
Thanks.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Apr 06, 2010 4:00 pm
Reply with quote

jctgf wrote:
Code:

EVALUATE TRUE
     WHEN WS-WORK-A     = SPACE and WS-WORK-B     = SPACE and WS-WORK-C = SPACE               
          MOVE '1'   TO ...
     WHEN WS-WORK-A NOT = SPACE and WS-WORK-B     = SPACE and WS-WORK-C = SPACE               
          MOVE '2'   TO  ... 
     WHEN WS-WORK-A     = SPACE and WS-WORK-B NOT = SPACE and WS-WORK-C = SPACE               
          MOVE '3'   TO  ... 
     WHEN OTHER                           
          MOVE '4'   TO  ... 
END-EVALUATE.                       


Hi,
Is there any reason not to use the code above? Is the original code posted (with the "also" option) more efficient than this?
Thanks.

I have been offline (on vacation) the last week, hence the late reply.

One reason for not using the code as written is for clarity and ease of maintanance, as you have negated logical statements put in, where you could as well evaluate the condition as FALSE. Performancewise, I would recon that this construct where you compute the compound logical expression at each WHEN statement takes more processing power than specifying and executing the individual logical expressions at the EVALUATE statement separated by ALSO, and comparing the boolean results in each WHEN statements.

On the other hand this form of EVALUATE can only be used if the conditions involved can easily be formulated as one expression.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 06, 2010 8:15 pm
Reply with quote

efficient
Definition:

performing or functioning in the best possible manner with the least waste of time and effort;
having and using requisite knowledge, skill, and industry; competent; capable


sure is an overworked and miss-understood word.

key part of the definition:
the least waste of time and effort

and everyone who uses the word efficient seems to think that it only
applies to machine cycles.

as Kjeld so apply phrased: clarity and ease of maintanance

which is as important as saving the nano seconds.

also, if there are worries about efficiency of coded instructions,
why don't the posters of these suspected lack of efficient coding, code and test instead of voicing opinion?
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Apr 28, 2010 4:43 pm
Reply with quote

Hi,
I know it's a little off the topic, but just for the sake of curiosity I compared the EVALUATE command with and without the use of ALSO and I couldn't see any difference in the elapsed time.
Each WHEN clause of both EVALUATE executed 900 milion times.
Follows the code:

Code:

01  W-RESULT   PIC S9(04) COMP  VALUE 0.                         
01  A          PIC X(10)        VALUE ' '.                       
01  B          PIC X(10)        VALUE ' '.                       
01  C          PIC X(10)        VALUE ' '.                       
                                                               
                                                                 
LINKAGE SECTION.                                                 
01 LK-PARM.                                                       
   03 FILLER   PIC XX.                                           
   03 LK-OPC   PIC 9.                                             
   03 LK-TIMES PIC 9(09).                                         
                                                                 
PROCEDURE DIVISION USING LK-PARM.                                 
    DISPLAY 'PARM=' LK-PARM                                       
                                                                 
    PERFORM AAA LK-TIMES TIMES.                                   
                                                                 
    MOVE 'X' TO A                                                 
    PERFORM AAA LK-TIMES TIMES.                                   
                                                                 
    MOVE ' ' TO A                                                 
    MOVE 'X' TO B                                                 
    PERFORM AAA LK-TIMES TIMES.                                   
                                                                 
    STOP RUN.                                                     
                                                                 
                                                                 
AAA.                                                             
    IF LK-OPC = 1                                                 
       EVALUATE TRUE ALSO TRUE ALSO TRUE                         
       WHEN A= SPACE      ALSO B = SPACE     ALSO C = SPACE       
            MOVE 1 TO W-RESULT                                   
       WHEN A NOT = SPACE ALSO B = SPACE     ALSO C = SPACE       
            MOVE 2 TO W-RESULT                                   
       WHEN A = SPACE     ALSO B NOT = SPACE ALSO C = SPACE       
            MOVE 3 TO W-RESULT                                   
       END-EVALUATE                                               
    ELSE                                                         
       EVALUATE TRUE                                             
       WHEN A= SPACE      AND  B = SPACE     AND  C = SPACE       
            MOVE 1 TO W-RESULT                                   
       WHEN A NOT = SPACE AND  B = SPACE     AND  C = SPACE       
            MOVE 2 TO W-RESULT                                   
       WHEN A = SPACE     AND  B NOT = SPACE AND  C = SPACE       
            MOVE 3 TO W-RESULT                                   
       END-EVALUATE                                               
    END-IF.               


Code:

CSV016I REQUESTED MODULE IRXFUSER IS NOT EXECUTABLE                             
-                                      -----TIMINGS (MINS.)------               
-STEPNAME PROCSTEP    RC   EXCP   CONN       TCB       SRB  CLOCK          SERV
-EVTPTSTB             00    285   3943       .87       .00    1.0           406
IEF451I J948T01 EVTPTSTB - ENDED BY CC 0000 - TIME=07.59.04           


Code:


CSV016I REQUESTED MODULE IRXFUSER IS NOT EXECUTABLE                             
-                                      -----TIMINGS (MINS.)------               
-STEPNAME PROCSTEP    RC   EXCP   CONN       TCB       SRB  CLOCK          SERV
-EVTPTSTB             00    286   3730       .86       .00    1.0           423
IEF451I J948T02 EVTPTSTB - ENDED BY CC 0000 - TIME=07.59.01                                               

Thanks.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon May 03, 2010 2:01 pm
Reply with quote

jctgf wrote:
Hi,
I know it's a little off the topic, but just for the sake of curiosity I compared the EVALUATE command with and without the use of ALSO and I couldn't see any difference in the elapsed time.
Each WHEN clause of both EVALUATE executed 900 milion times.

I admit there is no significant difference in processing these statements, but the compiler optimisation does a great job in jumping out of a boolean expression with ANDs when it is clear that the result cannot be changed by subsequent subexpressions, ie. after the first subexpression that evaluates FALSE.

My point where not as much using ALSO or AND between sub expressions but more avoiding interspersed negated expressions in multiple WHEN statements for clarity's sake.

You didn't test my suggested EVALUATE statement, now you were at it?
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Mon May 03, 2010 6:40 pm
Reply with quote

hi there,
i ran the comparison 4 times.
each time runs a pair of jobs.
job 1 has the poster original evaluate.
job 2 has the avaluate you suggested.

1st comparison:
original:
Code:
 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .87       .00    2.0           435  BATCH        0     0     0     0     
0000 - TIME=09.42.56                                                             
      TOTAL TCB CPU TIME=      .87 TOTAL ELAPSED TIME=   2.0                     

suggested:
Code:
 
 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .86       .00    2.0           440  BATCH        0     0     0     0     
0000 - TIME=09.43.02                                                             
      TOTAL TCB CPU TIME=      .86 TOTAL ELAPSED TIME=   2.0                     


2nd comparison:

original:
Code:
                                                                                 
         --TIMINGS (MINS.)--            -----PAGING COUNTS----                   
    TCB    SRB  CLOCK   SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS                   
 224.17    .00    1.0  1343K  BATCH        0     0     0     0                   
0000 - TIME=09.45.18                                                             
      TOTAL TCB CPU TIME=    .87 TOTAL ELAPSED TIME=   1.0                       

suggested:
Code:
 
         --TIMINGS (MINS.)--            -----PAGING COUNTS----                   
    TCB    SRB  CLOCK   SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS                   
 221.95    .00    1.0  1330K  BATCH        0     0     0     0                   
0000 - TIME=09.45.14                                                             
      TOTAL TCB CPU TIME=    .86 TOTAL ELAPSED TIME=   1.0                       


3rd comparison:

original:
Code:
                                                                                 
                                                                                 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .87       .00    2.0           384  BATCH        0     0     0     0     
0000 - TIME=09.49.47                                                             
      TOTAL TCB CPU TIME=      .87 TOTAL ELAPSED TIME=   2.0                     

suggested:
Code:
 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .86       .00    2.1           383  BATCH        0     0     0     0     
0000 - TIME=09.49.58                                                             
      TOTAL TCB CPU TIME=      .86 TOTAL ELAPSED TIME=   2.1                     



4th comparison:
original:
Code:
                                                                                 
                                                                                 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .87       .00    1.5           403  BATCH        0     0     0     0     
0000 - TIME=09.54.35                                                             
      TOTAL TCB CPU TIME=      .87 TOTAL ELAPSED TIME=   1.5                     
                           

suggested:
Code:
 
 -----TIMINGS (MINS.)------                          -----PAGING COUNTS----     
       TCB       SRB  CLOCK          SERV  WORKLOAD  PAGE  SWAP   VIO SWAPS     
       .86       .00    1.5           410  BATCH        0     0     0     0     
0000 - TIME=09.54.34                                                             
      TOTAL TCB CPU TIME=      .86 TOTAL ELAPSED TIME=   1.5                     




the result is the same, except for comparison 3. it may be due to the machine load situation at the moment of the execution.
each evaluate is tested 900 million times and the jobs ran at the same time to ensure they were under the same conditions.

the program:
Code:
                                                                                 
> APPLID(ROS0P03)    USER(HB1,E817252)                                           
> LIB(HB1.EVTPTST0)   SCRL CSR  COLS 00001 00072                   LINE 000062   
>      <...+....1....+....2....+....3....+....4....+....5....+....6....+....7.. 
000062 000790 PROCEDURE DIVISION USING LK-PARM.                                 
000063            DISPLAY 'PARM=' LK-PARM                                       
000064                                                                           
000065            PERFORM AAA LK-TIMES TIMES.                                   
000066                                                                           
000067            MOVE 'X' TO A                                                 
000068            PERFORM AAA LK-TIMES TIMES.                                   
000069                                                                           
000070            MOVE ' ' TO A                                                 
000071            MOVE 'X' TO B                                                 
000072            PERFORM AAA LK-TIMES TIMES.                                   
000073                                                                           
000074            STOP RUN.                                                     
000075                                                                           
000076                                                                           
000077                                                                           
000078        AAA.                                                               
000079            IF LK-OPC = 1                                                 
000080               EVALUATE TRUE ALSO TRUE ALSO TRUE                           
000081               WHEN A= SPACE      ALSO B = SPACE     ALSO C = SPACE       
000082                    MOVE 1 TO W-RESULT                                     
000083               WHEN A NOT = SPACE ALSO B = SPACE     ALSO C = SPACE       
000084                    MOVE 2 TO W-RESULT                                     
000085               WHEN A = SPACE     ALSO B NOT = SPACE ALSO C = SPACE       
000086                    MOVE 3 TO W-RESULT                                     
000087               END-EVALUATE                                               
000088            ELSE                                                           
000089               EVALUATE A = SPACE ALSO B = SPACE ALSO C = SPACE           
000092                 WHEN TRUE ALSO TRUE ALSO TRUE                             
000093                      MOVE 1        TO W-RESULT                           
000094                 WHEN FALSE ALSO TRUE ALSO TRUE                           
000095                      MOVE 2        TO W-RESULT                           
000096                 WHEN TRUE ALSO FALSE ALSO TRUE                           
000097                      MOVE 3        TO W-RESULT                           
000098                 WHEN OTHER                                               
000099                      MOVE 4        TO W-RESULT                           
000100               END-EVALUATE         
000101 *******       EVALUATE TRUE                                             
000102 *******       WHEN A= SPACE      AND  B = SPACE     AND  C = SPACE       
000103 *******            MOVE 1 TO W-RESULT                                   
000104 *******       WHEN A NOT = SPACE AND  B = SPACE     AND  C = SPACE       
000105 *******            MOVE 2 TO W-RESULT                                   
000106 *******       WHEN A = SPACE     AND  B NOT = SPACE AND  C = SPACE       
000107 *******            MOVE 3 TO W-RESULT                                   
000108 *******       END-EVALUATE                                               
000109            END-IF.                                           
SPACE       


Thanks.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon May 03, 2010 7:46 pm
Reply with quote

Thanks jctgf for your effort,

I think the only conclusion for this is: What form of evaluate statement you use is not significant to processing time and resources.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Add condition to a FINDREP SORT card DFSORT/ICETOOL 4
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
Search our Forums:

Back to Top