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

COMP-3 VARIABLE IN CONDITION STATEMENTS.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
seerajen
Currently Banned

New User


Joined: 05 Aug 2008
Posts: 10
Location: bangalore

PostPosted: Wed Feb 25, 2009 5:43 pm
Reply with quote

hello All,
my code is getting abended when iam trying to verify a comp-3 variable.

i have declare a varible like

Code:
01    cm-test                      pic S9(6)v9(4).
01    abc                            pic   99.

and the code is

Code:
Evaluate True
 when cm-test = zeroes
   move 10 to abc
  when other
    move 20 to abc
end-evaluate.


but my code is abending at Evaluate, is that the conditional statement with comp-3 variable is valid.

regards,
seenu.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Feb 25, 2009 5:49 pm
Reply with quote

Quote:
01 cm-test pic S9(6)v9(4).

Is this COMP-3 field?

Quote:
but my code is abending at Evaluate

Please post the error code and message.
Back to top
View user's profile Send private message
seerajen
Currently Banned

New User


Joined: 05 Aug 2008
Posts: 10
Location: bangalore

PostPosted: Wed Feb 25, 2009 5:51 pm
Reply with quote

sorry for the mistake happend....

ya u r right........its a comp-3 variable the declaration is as:

01 cm-test pic S9(6)v9(4) comp-3.

thanks,
seenu
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Feb 25, 2009 5:58 pm
Reply with quote

You should first test cm-test for numeric-ness...
Would "when cm-test numeric also cm-test = zeroes" work?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Feb 25, 2009 6:02 pm
Reply with quote

I can't remember for sure,
but I believe you can not rely on the resolution order of an 'ALSO' in a WHEN.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Feb 25, 2009 6:07 pm
Reply with quote

Does cm-test contain a value or initialized?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Feb 25, 2009 9:54 pm
Reply with quote

As alluded to, I'd put the EVALUATE inside an IF statement that tests for NUMERIC.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top