You are here:

Cobol/COBOL how to remove Leading zeros

Advertisement


Question
I am new at COBOL I have a Customer value
05  CUST-CODE  PIC S9(9) comp-3.

THe value is Numeric on the Data Base.  When I DISPLAY this value
if the customer number is  241285
it displays  as  +000241285
and would like to display the value as it is 241285

I am sure there is a simple solution but again I am not prolific in COBOL...
Thanks

Answer
You need to do a numeric EDITed move.  You get the results you have because the value is SIGNED and has all the leading zeros.  Look in your manual for how to EDIT with ZERO SUPPRESS. (I want you to rely on the BOOK, not me.)  It is very simple.

If you have difficulty understanding what it says, please reply again.

David  

Cobol

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Nelson

Expertise

I specialize in IBM z/OS COBOL and MicroFocus OCDS and Server Express non-OOP. Design, coding and performance oriented questions. Also linking to IBM Assembler from COBOL. Because the rules change with version, please state language level, version and platform environment. See CICS for questions about CICS.

Experience

Over 35 years working with COBOL on multiple platforms and OS.

Education/Credentials
Graduate, New York School of Computer Technology.

Past/Present Clients
Major Financial Institutions, State of NC (DHHS), Manufacturing, Financial services, Warehousing, Software developer and others.

©2016 About.com. All rights reserved.