convert S9(5)V9(2) Comp 3 to alphanumeric

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Arun Rajput
New Member
Posts: 9
Joined: Tue Jan 20, 2015 8:40 am
India

convert S9(5)V9(2) Comp 3 to alphanumeric

Post by Arun Rajput »

Hi,

How can we convert S9(5)V9(2) Comp 3 to alphanumeric so that i can display the amount??

Thanks for the help.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: convert S9(5)V9(2) Comp 3 to alphanumeric

Post by Robert Sample »

COBOL MOVE statement.
User avatar
zum13
Registered Member
Posts: 84
Joined: Thu May 04, 2023 12:58 am

Re: convert S9(5)V9(2) Comp 3 to alphanumeric

Post by zum13 »

Hello.

It's just a matter of moving your non-displayable value to a field that is displayable. So, for S9(5)V9(2), a field defined as -9(5).9(2) would give you a result which would be an minus sign (or blank if the number is positive) and your number with leading zeros. Changing the minus to a plus means the sign is shown whether positive or negative. A definition of -Z9(4)9.9(2) would give you a result without the leading zeros.
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.”