Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
comparing alphanumeric with comp-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sumivel

New User


Joined: 13 Sep 2005
Posts: 18

PostPosted: Mon Jun 26, 2006 6:06 pm    Post subject: comparing alphanumeric with comp-3
Reply with quote

The given Spec is as follows

01 a pic x(7) value '123.456'
.
.
.
01 b pic s9(3)v9(3) comp.


if a = b
display 'equal'
else
display'not equal'

**************************************


i tried comparing by redefining
'a' with pic clause 9(3)v9(3)...
it didnot work...can anyone help
me for the above problem.
Back to top
View user's profile Send private message

IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Jun 26, 2006 7:31 pm    Post subject: Re: comparing alphanumeric with comp-3
Reply with quote

what value do you have in b ?
Back to top
View user's profile Send private message
SIVAMAIN

New User


Joined: 24 Jun 2006
Posts: 12

PostPosted: Mon Jun 26, 2006 8:20 pm    Post subject:
Reply with quote

hi sumivel , this is siva

by coding we can do
WORKING-STORAGE SECTION.
01 A PIC X(5) VALUE IS '12345'.
01 B PIC 9(5) VALUE 12345.
PROCEDURE DIVISION.
IF A = B THEN
DISPLAY 'EQUAL'
ELSE
DISPLAY 'NOT EQUAL'
END-IF.
DISPLAY A.
DISPLAY B.

but when i tried the following code it showing error
WORKING-STORAGE SECTION.
01 A PIC X(6) VALUE IS '123.45'.
01 B PIC 9(3)V99.
PROCEDURE DIVISION.
MOVE 123.45 TO B.
IF A = B THEN
DISPLAY 'EQUAL'
ELSE
DISPLAY 'NOT EQUAL'
END-IF.
DISPLAY A.
DISPLAY B.

error shown by complier
IGYPA3022-S "A (ALPHANUMERIC)" was compared with "B (NUMERIC NON-INTEGER)". The comparison was discarded.
Back to top
View user's profile Send private message
sumivel

New User


Joined: 13 Sep 2005
Posts: 18

PostPosted: Tue Jun 27, 2006 2:20 pm    Post subject: Re: comparing alphanumeric with comp-3
Reply with quote

i am working on web based COBOL Program....my input from web will be colledcted in variable say DISCOUNT with pic clause X(7)...in the program the DISCOUNT from the web shud be compared with the host variable WS-DISCOUNT with pic clause s9(3)v9(3) comp-3.

SAY....
01 DISCOUNT PIC x(7). let's value be 123.456

my host variable
WS-DISCOUNT PIC S9(3)V9(3) COMP-3
Back to top
View user's profile Send private message
luban

New User


Joined: 19 Nov 2005
Posts: 26
Location: Shanghai, China

PostPosted: Sat Jul 01, 2006 9:57 pm    Post subject:
Reply with quote

Hi Sumivel,

I think you can't compar alphanumeric with comp-3 in COBOL.
Maybe a numeric variable is needed.

Best regards,
Ban
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Jul 27, 2006 4:15 am    Post subject:
Reply with quote

Hi Sumivel,

Go to the manuals at this site and do some reading about NUMVAL and NUMVAL-C.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing two sequential files Mohan Kothakota COBOL Programming 14 Mon Apr 16, 2018 6:35 pm
No new posts To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
No new posts COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us