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

Compiler Error IGYPA3009-S in Evaluate Statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PRABHATH
Warnings : 1

New User


Joined: 08 Jun 2006
Posts: 28
Location: hyderabad

PostPosted: Tue Nov 06, 2007 3:42 pm
Reply with quote

We're having a problem coding an EVALUATE statement in place of
nested IFs.

Working Storage looks something like:

01 .....
05 WS-EIBCPOSN PIC S9(4) VALUE ZEROS.
88 FUNC-SET VALUES 241, 242, 243, 244.
88 FUNC-IGEN VALUES 241, 242.


The Procedure Division code that works:

IF FUNC-SET
IF FUNC-IGEN
MOVE .....

The Procedure Division code that doesn't work:
-------
IF FUNC-SET
EVALUATE WS-EIBCPSON
WHEN FUNC-IGEN
MOVE ....

We get a compile error IGYPA3009-S that says:
"The selection object at position 1 in the "WHEN" phrase did not
match the type of the corresponding selection subject in the
"EVALUATE" statement. The selection object was discarded."

So what's wrong here?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Nov 06, 2007 4:13 pm
Reply with quote

Use EVALUATE TRUE when your WHENs are 88 levels.

WHEN FUNC-IGEN only returns true or not true.

But if your EVALUATE interrogates the value of a data-element, your WHENs must return equal lt,gt.
Back to top
View user's profile Send private message
gixcng

New User


Joined: 26 Oct 2007
Posts: 15
Location: chennai

PostPosted: Tue Nov 06, 2007 4:15 pm
Reply with quote

hi prabhath,

can you be more clear. what is the group variable here,under which the condition names are defined?
if at all the condition constants were to be
checked , their condition variables should be set.

if iam not wrong,you have not set the condition variable.
for ex:
WORKING-STORAGE SECTION.
01 CONDSCHE PIC 9(2).
88 EVENM VALUE 04,06,08,10,12.
88 ODDM VALUE 01,03,05,07,09,11.
88 FEB VALUE 02.
PROCEDURE DIVISION.
ACCEPT DAT.

MOVE MT TO CONDSCHE. //*setting the CONDSCHE
DIVIDE YR BY 4 GIVING YR1 REMAINDER YC.
IF YC = 0
IF (MT < 01) OR (MT > 12)
DISPLAY "INVALID MONTH"
ELSE
IF EVENM AND (DAYM > 30)

if iam not answering the question you are referring to,please let me know.

regards
Back to top
View user's profile Send private message
PRABHATH
Warnings : 1

New User


Joined: 08 Jun 2006
Posts: 28
Location: hyderabad

PostPosted: Tue Nov 06, 2007 5:01 pm
Reply with quote

Hi ,

For example:
IDENTIFICATION DIVISION.
PROGRAM-ID. EVALEX.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 REG PIC X(2).
88 C1 VALUE 'R1'.
88 C2 VALUE 'R2'.
88 C3 VALUE 'R3'.
PROCEDURE DIVISION.
MAIN-PARA.
ACCEPT REG.
EVALUATE REG
WHEN C1 DISPLAY 'WELCOME TO REGION 1'
WHEN C2 DISPLAY 'WELCOME TO REGION 2'
WHEN C3 DISPLAY 'WELCOME TO REGION 3'
WHEN OTHER DISPLAY 'THERES NO REGION DEFINED'
END-EVALUATE.
STOP RUN.

This would return the same result as before.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Tue Nov 06, 2007 5:27 pm
Reply with quote

Hi Prabhath,

Could you tell me, What u r doing here

Code:
IF FUNC-SET
    EVALUATE WS-EIBCPSON
         WHEN FUNC-IGEN
                  MOVE ....


See, In above code FUNC-SET and FUNC-IGEN are the conditional data item for WS-EIBCPSON variable so Both variable will going to have same value so you can use below code

EVALUATE WS-EIBCPSON
WHEN FUNC-SET
WHEN FUNC-IGEN
MOVE .............
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Nov 06, 2007 5:29 pm
Reply with quote

Hi Prabhath,

Code:
This would return the same result as before.


Ru still facing problem?
Back to top
View user's profile Send private message
PRABHATH
Warnings : 1

New User


Joined: 08 Jun 2006
Posts: 28
Location: hyderabad

PostPosted: Tue Nov 06, 2007 5:49 pm
Reply with quote

Thanx Dick,

that worked for me...EVALUATE TRUE did well here.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Nov 06, 2007 7:56 pm
Reply with quote

Thanks for sharing the solution Prabath. icon_smile.gif This is a good practice to complete the thread.
Back to top
View user's profile Send private message
gixcng

New User


Joined: 26 Oct 2007
Posts: 15
Location: chennai

PostPosted: Wed Nov 07, 2007 10:25 am
Reply with quote

hi everyone,

ya EVALUATE TRUE did work icon_smile.gif

if we have several condition variables:
01 cond_che1
88....
88...
01 cond_che2
88...
88...
procedure division.
accept cond_che1
accept cond_che2
evaluate true...
(now,what variable will it check for?)
for me,
evaluate cond_che1 true dint work!!
Back to top
View user's profile Send private message
PRABHATH
Warnings : 1

New User


Joined: 08 Jun 2006
Posts: 28
Location: hyderabad

PostPosted: Wed Nov 07, 2007 12:40 pm
Reply with quote

Hi Gayathri,

I did try out an example for such a case...

For example in the following program:

IDENTIFICATION DIVISION.
PROGRAM-ID. EVALEX.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 T1 PIC 9(2).
01 REG PIC X(2).
88 C1 VALUE 'R1'.
88 C2 VALUE 'R2'.
88 C3 VALUE 'R3'.
01 REF PIC 9(2).
88 C5 VALUE 80.
88 C6 VALUE 90.
01 MONTH PIC 9(2).
PROCEDURE DIVISION.
MAIN-PARA.
ACCEPT REF.
ACCEPT T1.
ACCEPT REG.
DISPLAY T1.
EVALUATE TRUE
WHEN C1 DISPLAY 'WELCOME TO REGION 1'
WHEN C2 DISPLAY 'WELCOME TO REGION 2'
WHEN C3 DISPLAY 'WELCOME TO REGION 3'
WHEN OTHER DISPLAY 'THERES NO REGION DEFINED'
END-EVALUATE.
EVALUATE TRUE
WHEN C5 DISPLAY 'VALUE IS 80'
WHEN C6 DISPLAY 'VALUE IS 90'
WHEN OTHER DISPLAY 'WRONG ENTRY'
END-EVALUATE.
ACCEPT MONTH.
EVALUATE MONTH
WHEN 11 DISPLAY 'THIS IS NOVEMBER'
WHEN 12 DISPLAY 'THIS IS DECEMBER'
WHEN 1 THRU 10 DISPLAY 'VALUES OF LAST MONTHS' MONTH
WHEN OTHER DISPLAY 'WRONG ENTRY'
END-EVALUATE.
STOP RUN.

run this out...and you would come to know....
Back to top
View user's profile Send private message
PRABHATH
Warnings : 1

New User


Joined: 08 Jun 2006
Posts: 28
Location: hyderabad

PostPosted: Wed Nov 07, 2007 12:41 pm
Reply with quote

the above example shows the usage of EVALUATE in 2 different ways...
Back to top
View user's profile Send private message
gixcng

New User


Joined: 26 Oct 2007
Posts: 15
Location: chennai

PostPosted: Wed Nov 07, 2007 12:59 pm
Reply with quote

ya prabhath, it did work!

so the condition variables are set,in a way letting EVALUATE true.


thank you
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
Search our Forums:

Back to Top