You are here:

Cobol/COBOL how to remove Leading zeros


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...

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.



All Answers

Answers by Expert:

Ask Experts


David Nelson


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.


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

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.

©2017 All rights reserved.