Compare alphanumeric with comp-3, possible?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Ajay Chowdhary
New Member
Posts: 5
Joined: Tue Apr 29, 2014 10:06 am

Compare alphanumeric with comp-3, possible?

Post by Ajay Chowdhary »

Hi,

I'm involved in coding a program which has got a web based interface. The input from web will be taken in variable WEB-IN with PIC X(7). In the program I need to compare this with a working storage variable WS-AMOUNT, it is defined as PIC S9(3)v9(3) comp-3.

Assume, WEB-IN has the value 123.456, can someone please tell me how to compare an alphanumeric with comp-3 variable now?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Compare alphanumeric with comp-3, possible?

Post by Robert Sample »

Use intrinsic function NUMVAL to convert WEB-IN into a numeric PIC S9(03)V9(03) variable, then do the comparison.
Ajay Chowdhary
New Member
Posts: 5
Joined: Tue Apr 29, 2014 10:06 am

Re: Compare alphanumeric with comp-3, possible?

Post by Ajay Chowdhary »

Thanks, this has helped.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”