Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us